[Question]
  [
**This is a good beginner challenge and a good time killer.**
*I only said a -natural- log because the title was too short, this has nothing to do with logarithms.*
Given 2 variables:
* The number of ants `n`.
* The width of the log `w`.
Output a log of width `w` with `n` ants (Example shown `w=3`, `n=6`)
```
|             |
| \O/ \O/ \O/ |
| -O- -O- -O- |
| /o\ /o\ /o\ |
|  ^   ^   ^  |
|             |
| \O/ \O/ \O/ |
| -O- -O- -O- |
| /o\ /o\ /o\ |
|  ^   ^   ^  |
|             |
```
A single ant looks like this:
```
\O/ # Upper-case O
-O- # Upper-case O
/o\ # Lower-case o
 ^  
```
***A few ant laws:***
1. Ants may not touch each other nor the edge of the log directly, they
prefer to touch spaces.
2. Each row of ants must be `w` wide, with `n/w` rows of ants.
3. Ants always need a log, the log width is greater than 0, guaranteed.
4. Ants also... well, need ants, the number of ants is greater than 0, guaranteed.
5. Ants are also surprisingly well organized, they will fill a log from left to right, top to bottom; as if they were reading a book.
***Ant-xamples***
**w=3, n=5**
```
|             |
| \O/ \O/ \O/ |
| -O- -O- -O- |
| /o\ /o\ /o\ |
|  ^   ^   ^  |
|             |
| \O/ \O/     |
| -O- -O-     |
| /o\ /o\     |
|  ^   ^      |
|             |
```
**w=1, n=1**
```
|     |
| \O/ |
| -O- |
| /o\ |
|  ^  |
|     |
```
**w=1, n=3**
```
|     |
| \O/ |
| -O- |
| /o\ |
|  ^  |
|     |
| \O/ |
| -O- |
| /o\ |
|  ^  |
|     |
| \O/ |
| -O- |
| /o\ |
|  ^  |
|     |
```
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), the person with the smallest bytecount wins.
  
[Answer]
# [V](https://github.com/DJMcMayhem/V), ~~70~~, 68 bytes
```
i \O/ 
 -O- 
 /o\ 
  ^  Àä{ò@bf }C GïpòÇÓ/d
HÄÒ çÞ/ÙÒ 
ëI|yê$p
```
[Try it online!](https://tio.run/nexus/v#@5@pEOOvr8CloOuvCyT182OApEKcgoL04YbDS8SqD29ySEpTEKt1VpB2P7y@4PCmw@2HJ@uncHkcbjk8SeHw8sPz9A/PBLK4xA6v9qyRrjy8SqXg////hgb/jQE "V – TIO Nexus")
```
00000000: 6920 5c4f 2f20 0a20 2d4f 2d20 0a20 2f6f  i \O/ . -O- . /o
00000010: 5c20 0a20 205e 2020 1bc0 e416 7bf2 4062  \ .  ^  ....{.@b
00000020: 6620 167d 4320 1b47 ef70 f2c7 d32f 640a  f .}C .G.p.../d.
00000030: 48c4 d220 e7de 2fd9 d220 0a16 eb49 7c1b  H.. ../.. ...I|.
00000040: 79ea 2470                                y.$p
```
This has never happened to me before, but [a known bug](https://github.com/DJMcMayhem/V/issues/7) has actually saved me bytes!
It's kinda hard to explain exactly what's going on, but unfortunately when you try to duplicate something by columns, V will move one column over before duplicating. Which is why originally I did:
```
h<C-v>{dÀp
```
which doesn't use the duplicate operator. However, because we already needed to move one line over, we can simply do 
```
hÀä<C-v>{
```
[Answer]
# PHP>=7.1, 150 Bytes
```
for([,$w,$n]=$argv;$i<ceil($n/$w)*5+1;)echo str_pad("| ".str_repeat(["","\O/ ","-O- ","/o\ "," ^  "][$i%5],$n<$w*ceil($i++/5)?$n%$w:$w),$w*4+2)."|\n";
```
[Online Version](http://sandbox.onlinephpfunctions.com/code/75a0070ae76a9a73d92650599cdcc2f4f91dca4d)
[Answer]
# Python 2, 144 bytes
```
n,w=input()
s=' ';k='|';a=k+s*w*4+s+k;print a
while n>0:
 for i in['\\O/','-O-','/o\\',' ^ ']:print k+s+(i+s)*min(w,n)+s*4*(w-n)+k
 n-=w;print a
```
[Try it Online!](https://tio.run/nexus/python2#NY07DsIwEER7n2K79VdBIjSxnCvkABikFCBWhk0UB7nh7sYSopmZ5r2pbEsgXt@7VCIHBPQp4Af9HJLJuujeZJP8uhHvMIvyoOcNeDwMAu7LBgTEZ4xx6tCim1zLbomxFVwBL8OPayYjyWSlX8SyWFZN3WtZXFtJALtQ/he1niwcvw)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~44~~ 43 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
*Crossed out 44 is not 44 with use of* `&nbsp;`
```
⁶ṁ;⁶jÐ€“\-/“OOo^ ”;UṖz⁶¤Y
sÇ€⁶;YỴz⁶Zj@€⁾||Y
```
**[Try it online!](https://tio.run/nexus/jelly#@/@ocdvDnY3WQCrr8IRHTWseNcyJ0dUHkv7@@XEKjxrmWoc@3DmtCih/aEkkV/HhdpCaxm3WkQ93bwGJRmU5gEX21dRE/v//39DovykA)**
### How?
```
⁶ṁ;⁶jÐ€“\-/“OOo^ ”;UṖz⁶¤Y - Link 1, make a row of ants: list x (could be integer = length)
⁶                         - literal ' '
 ṁ                        - mould like x (makes a list of that many spaces)
  ;⁶                      - concatenate one more space
                       ¤  - nilad followed by link(s) as a nilad
       “\-/“OOo^ ”        -   literal      ["\-/","OOo^ "] ("..." a list of chars really)
                   U      -   reverse each [" ^oOO","/-\"]
                  ;       -   concatenate  ["\-/","OOo^ "," ^oOO","/-\"]
                    Ṗ     -   pop          ["\-/","OOo^ "," ^oOO"]
                      ⁶   -   literal ' '
                     z    -   transpose & fill ["\O/","-O-","/o\"," ^ ","   "]
    jÐ€                   - join left mapped over right
                          -   (join the spaces with each of the ant parts in turn)
                        Y - join with newlines
sÇ€⁶;YỴz⁶Zj@€⁾||Y - Main link: n, w
s                 - split n into chunks of length w (implicitly makes a range of length n)
 Ç€               - call the last link (1) as a monad for €ach
   ⁶;             - a space concatenated with that
     Y            - join with newlines
      Ỵ           - split at newlines (both the ones we just joined with AND the others!)
       z⁶         - transpose & fill with space characters (making the shorter rows,
                  -   including the single space as long as the longest one)
         Z        - transpose it back the right way
             ⁾||  - literal ['|','|']
          j@€     - join with reverse arguments for €ach (put each row between pipes)
                Y - join back up with newlines
                  - implicit print
```
---
I have asked about `w<n` in [a comment](https://codegolf.stackexchange.com/questions/117268/ants-on-a-natural-log#comment286753_117268) since it's slightly ambiguous.  
If the log needs to be `w` ants wide rather than just the ants being `w` wide, it costs two bytes:
```
⁶ṁ;⁶jÐ€“\-/“OOo^ ”;UṖz⁶¤Y
+RsÇ€YỴz⁶Zj@€⁾||ṫ5Y
```
This does the same as before except rather than prepending a single space to make the first, blank line it creates a whole extra row of ants and chops off all but its trailing blank line.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 47 bytes
```
"   \O/-O-/o\ ^ "5äðìI.D)IôvyøJ'|ì})˜¬¸«.B„ |«»
```
[Try it online!](https://tio.run/nexus/05ab1e#AUMAvP//IiAgIFxPLy1PLS9vXCBeICI1w6TDsMOsSS5EKUnDtHZ5w7hKJ3zDrH0py5zCrMK4wqsuQuKAniB8wqvCu///NQoz "05AB1E – TIO Nexus")
**Explanation**
```
"   \O/-O-/o\ ^ "                                # push the ant-string
                 5ä                              # split into 5 parts
                   ðì                            # prepend a space to each
                     I.D                         # copy input-1 number of times
                        )                        # wrap in a list
                         Iô                      # split into parts each the size of input-2
                           v                     # for each row of ants
                            yø                   # zip, so body parts are on the same row
                              J'|ì               # join to string and prepend a pipe to each
                                  }              # end loop
                                   )˜            # wrap in a flattened list
                                     ¬¸«         # append a copy of the first row (spaces)
                                        .B       # pad rows to equal length with spaces
                                          „ |«   # append " |" to each row
                                              »  # merge on newlines
```
[Answer]
# [SOGL](https://github.com/dzaima/SOGL), ~~74~~ ~~71~~ 74 [bytes](https://github.com/dzaima/SOGL/blob/master/chartable.md)
```
 |pe4*I@*o |o→L:"╔O¦‘2n;"nΤ↕¬┐α┐PΝld‘*┼eG-’⁵@**┼ |4*┼OL→ALbe÷:?{eA}}be%:?A
```
First part: function which outputs an empty log part
```
             →L  define function L
 |p              output in a newline "|"
   e4*           multiply width by 4
      I          increace that
       @*        get that many spaces
         o       append [to current line] that
           |o    append "|"
```
The second part has a compressed string `"nΤ↕¬┐α┐PΝld‘`, which is the ant. It decompresses to `\-/ OOo^/-\` .
That's the ant (with spacing to the right), but taken top-to-down then to right like
```
159d
26ae
37bf
48cg
```
It's stored like that because the `┼` function appends strings like that (that's because then you can multiply the string to add multiple instances to it).
The part itself: function which asks for a number on stack denoting how many ants to draw.
```
                                    Example input: width 3, on stack 2
:                                   duplicate the input                             [2,2]
 "╔O¦‘                              push "| | | | "                                 [2,2,"| | | | "]
      2n                            split into chunks of two                        [2,2,["| ","| ","| ","| "]]
        ;                           put one of the input copies ontop of the stack  [2,["| ","| ","| ","| "], 2]
         "...‘*                     multiply that many ants                         [2,["| ","| ","| ","| "], "\\-/ OOo^/-\\     \\-/ OOo^/-\\     "]
               ┼                    add horizontally the ants                       ["| \O/ \O/ \O/ ",
                                                                                     "| -O- -O- -O- ",
                                                                                     "| /o\ /o\ /o\ ",
                                                                                     "|  ^   ^   ^  "]
                e                   get the width                                   [["| \\O/ \\O/ \\O/ ", "| -O- -O- -O- ", "| /o\\ /o\\ /o\\ ", "|  ^   ^   ^  "], 3]
                 G-                 subtract input from it                          [["| \\O/ \\O/ \\O/ ", "| -O- -O- -O- ", "| /o\\ /o\\ /o\\ ", "|  ^   ^   ^  "], 1]
                   ’⁵@*             push 16 spaces                                  [["| \\O/ \\O/ \\O/ ", "| -O- -O- -O- ", "| /o\\ /o\\ /o\\ ", "|  ^   ^   ^  "], 1, "                "]
                       *            multiply [the 16 spaces and empty place count]  [["| \\O/ \\O/ \\O/ ", "| -O- -O- -O- ", "| /o\\ /o\\ /o\\ ", "|  ^   ^   ^  "], "                "]
                        ┼           add that horizontally                           [["| \\O/ \\O/ \\O/     ", "| -O- -O- -O-     ", "| /o\\ /o\\ /o\\     ", "|  ^   ^   ^      "]]
                          |4*┼      add 4 vertical bars to the array                [["| \\O/ \\O/ \\O/     |", "| -O- -O- -O-     |", "| /o\\ /o\\ /o\\     |", "|  ^   ^   ^      |"]]
                              O     output the array                                []
                               L    call the empty line function                    []
                                →A  define as A
```
And the main function:
```
L                  call the empty line drawing function
 be÷               push floor(b/e) (the amount of full lines)
    :?{eA}}        that many times call A with the full width on the stack
           be%     push b%e (the leftovers)
              :?   if truthy (aka !=0)
                A   call A with for the leftovers
```
[Answer]
# [Perl 5](https://www.perl.org/), 159 bytes
```
($w,$n)=@ARGV;
print
$_%$w?"":"| ",
['   \O/-O-/o\\ ^ '=~/.../g]->[($_<5*$w*int$n/$w||$_%$w<$n%$w?$_/$w:0)%5],
($_+1)%$w?" ":" |\n"
for 0..$w*(6+5*int(($n-1)/$w))-1
```
[Try it online!](https://tio.run/nexus/perl5#HUzNCsIwGHuVUgKf03XTKQjW@nPyOPDgqSgdCm7o5xChHvrutTOHhIQkcQSfgzOz2x8PJ43GkKBvCseLySzT6AyckcFykPrpenTFUCgkLkIOtTV4C79KDwWJhP9WDRYuJ2vrknJStUpcvqxNIs6CHF/BysALf28fN/Bmqvt3yx8Z0KBDE2SMsarifPkD "Perl 5 – TIO Nexus")
# [Perl 5](https://www.perl.org/), 152 bytes
Another one based on the Python solution:
```
($w,$n)=@ARGV;
$b=' 'x($w*4+1);$j=$a="|\n|";
map$j.=' '."$_ "x($w<$n?$w:$n).'    'x($w-$n).$a,'\\O/','-O-','/o\\',' ^ 'and$n-=$w
while$n>0;
print"|$b$j$b|"
```
[Try it online!](https://tio.run/nexus/perl5#HUzNCsIwGHuVUgKf03XTKQjW@nPyOPDgqSgdCm7o5xChHvrutTOHhIQkcQSfgzOz2x8PJ43GkKBvCseLySzT6AyckcFykPrpenTFUCgkLkIOtTV4C79KDwWJhP9WDRYuJ2vrknJStUpcvqxNIs6CHF/BysALf28fN/Bmqvt3yx8Z0KBDE2SMsarifPkD "Perl 5 – TIO Nexus")
[Answer]
## Mathematica 210 Bytes
```
StringRiffle[If[#2==c||#2==1,"|",If[r-#1<6&&#2>2+4 (a+w-h w),Table[" ",5,4],Characters@"    \\O/ -O- /o\\  ^  "~Partition~4][[1+Mod[#1-1,5],1+Mod[#2+1,4]]]]&~Array~{r=5(h=⌈(a=#)/(w=#2)⌉)+1,c=4w+3},"\n",""]&
```
Thinking I need to make a Mathematica based golfing language.
[Answer]
## Python 2, 166 bytes
```
w,n=input()
print'\n'.join(['|'+' '*w*4+' |']+[' '.join(['|']+[p]*r+['   ']*(w-r)+['|'])for r in[w]*(n/w)+[[],[n%w]][n%w>0] for p in['\O/','-O-','/o\\',' ^ ','   ']])
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 43 bytes
```
ＮθＦ⪪× Ｎθ«←Ｐ↓⁶Ｍ⊗⊕⊗θ→Ｐ↓⁶⸿Ｅ⪪\O/-O-/o\ ^ ³⭆ι⁺μκ
```
[Try it online!](https://tio.run/##fY49D4IwEIZn@RWXTm1S4kB0wNWFRJSoIzFBLNjYDywtDsbfXovR6OR29@a55976XJlaV8L7THXOrp08MoOvZBE12gDedYJbvOeS9RgBovBLEULhSgjco0muB4bTFWtsuJzkTljeGa4sTpf6pijMX/EILbU7CnbCmaoNk0zZMH@yIAvKdMvb8z9P8UpQadB3y6vuXRaVm2m8iae6hMPYOAnKnQ1QOzKcQiFcjyWFS/gWBA/vk2jm40E8AQ "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
Ｎθ
```
Input `w`.
```
Ｆ⪪× Ｎθ«
```
Input `n`, then create a string of `n` spaces and split it into rows of length `w` (except the last piece which may be smaller). Loop over those rows.
```
←Ｐ↓⁶Ｍ⊗⊕⊗θ→Ｐ↓⁶⸿
```
Print the sides of the log section.
```
  \O/-O-/o\ ^           Literal string
 ⪪            ³         Split into (4) pieces of length 3
Ｅ                       Map over each piece
               ⭆ι       Map over each row space
                 ⁺μκ    Appending the piece
                        Implicitly print the results on separate lines
```
]