Skip to main content
added 70 characters in body
Source Link

dc, 72 bytes

[3Q]sq2?dsa^1+2/dsusk[Ola^/O%plk1-dsk1>q]sp1[d5r^dOla^<psz1+d4/lu>t]dstx

0-based indexing.

This uses exact integer arithmetic -- no logarithm approximations. It will work up to the memory capacity of the computer.

Try the dc program online!


The dc code can be turned into a Bash solution:

Bash + GNU utilities, 96 77 75 bytes

u=$[(2**$1+1)/2]
dc -e "[O$1^/O%p]sp1[d5r^dO$1^<psz1+d4/$u>t]dstx"|head -$u

Try the Bash version online!

dc, 72 bytes

[3Q]sq2?dsa^1+2/dsusk[Ola^/O%plk1-dsk1>q]sp1[d5r^dOla^<psz1+d4/lu>t]dstx

0-based indexing.

Try the dc program online!


The dc code can be turned into a Bash solution:

Bash + GNU utilities, 96 77 75 bytes

u=$[(2**$1+1)/2]
dc -e "[O$1^/O%p]sp1[d5r^dO$1^<psz1+d4/$u>t]dstx"|head -$u

Try the Bash version online!

dc, 72 bytes

[3Q]sq2?dsa^1+2/dsusk[Ola^/O%plk1-dsk1>q]sp1[d5r^dOla^<psz1+d4/lu>t]dstx

0-based indexing.

This uses exact integer arithmetic -- no logarithm approximations. It will work up to the memory capacity of the computer.

Try the dc program online!


The dc code can be turned into a Bash solution:

Bash + GNU utilities, 96 77 75 bytes

u=$[(2**$1+1)/2]
dc -e "[O$1^/O%p]sp1[d5r^dO$1^<psz1+d4/$u>t]dstx"|head -$u

Try the Bash version online!

added 472 characters in body
Source Link

dc, 72 bytes

[3Q]sq2?dsa^1+2/dsusk[Ola^/O%plk1-dsk1>q]sp1[d5r^dOla^<psz1+d4/lu>t]dstx

0-based indexing.

Try the dc program online!


The dc code can be turned into a Bash solution:

Bash + GNU utilities, 96 77 75 bytes

u=$[(2**$1+1)/2]
dc -e "[O$1^/O%p]sp1[d5r^dO$1^<psz1+d4/$u>t]dstx"|head -$u

0-based indexing.

Try itthe Bash version online!

Bash + GNU utilities, 96 77 75 bytes

u=$[(2**$1+1)/2]
dc -e "[O$1^/O%p]sp1[d5r^dO$1^<psz1+d4/$u>t]dstx"|head -$u

0-based indexing.

Try it online!

dc, 72 bytes

[3Q]sq2?dsa^1+2/dsusk[Ola^/O%plk1-dsk1>q]sp1[d5r^dOla^<psz1+d4/lu>t]dstx

0-based indexing.

Try the dc program online!


The dc code can be turned into a Bash solution:

Bash + GNU utilities, 96 77 75 bytes

u=$[(2**$1+1)/2]
dc -e "[O$1^/O%p]sp1[d5r^dO$1^<psz1+d4/$u>t]dstx"|head -$u

Try the Bash version online!

deleted 109 characters in body
Source Link

Bash + GNU utilities, 96 7777 75 bytes

u=$[(2**$1+1)/2]
for((;++n<u*4;)){ dc -e "5[O$1^"[O$1^/O%p]sp$n^dO$1^<p";}|headO%p]sp1[d5r^dO$1^<psz1+d4/$u>t]dstx"|head -$u

0-based indexing.

This uses big integers and will be correct for any value of the input up to the memory capacity of the computer.

Try it online!Try it online!

Bash + GNU utilities, 96 77 bytes

u=$[(2**$1+1)/2]
for((;++n<u*4;)){ dc -e "5[O$1^/O%p]sp$n^dO$1^<p";}|head -$u

0-based indexing.

This uses big integers and will be correct for any value of the input up to the memory capacity of the computer.

Try it online!

Bash + GNU utilities, 96 77 75 bytes

u=$[(2**$1+1)/2]
dc -e "[O$1^/O%p]sp1[d5r^dO$1^<psz1+d4/$u>t]dstx"|head -$u

0-based indexing.

Try it online!

added 116 characters in body
Source Link
Loading
deleted 34 characters in body
Source Link
Loading
Source Link
Loading