Skip to main content
Commonmark migration
Source Link

#JavaScript, 93 85 bytes

JavaScript, 93 85 bytes

A port of Nick's Python solution.

n=>(g=x=>n--?g(x<y+~z/2n*6n+z%2n>>1n?++x:z<y/6n-~y/6n?++z-z:z=++y-y):[x,y,z])(y=z=0n)

Try It Online!

Saved 8 bytes thank to Arnauld's suggestion of using BigInts, plus a couple of other tweaks.

#JavaScript, 93 85 bytes

A port of Nick's Python solution.

n=>(g=x=>n--?g(x<y+~z/2n*6n+z%2n>>1n?++x:z<y/6n-~y/6n?++z-z:z=++y-y):[x,y,z])(y=z=0n)

Try It Online!

Saved 8 bytes thank to Arnauld's suggestion of using BigInts, plus a couple of other tweaks.

JavaScript, 93 85 bytes

A port of Nick's Python solution.

n=>(g=x=>n--?g(x<y+~z/2n*6n+z%2n>>1n?++x:z<y/6n-~y/6n?++z-z:z=++y-y):[x,y,z])(y=z=0n)

Try It Online!

Saved 8 bytes thank to Arnauld's suggestion of using BigInts, plus a couple of other tweaks.

deleted 16 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

#JavaScript, 93 85 bytes

A (rather rushed) port of Nick's Python solution.

n=>(g=x=>n--?g(x<y+~z/2n*6n+z%2n>>1n?++x:z<y/6n-~y/6n?++z-z:z=++y-y):[x,y,z])(y=z=0n)

Try It Online!

Saved 8 bytes thank to Arnauld's suggestion of using BigInts, plus a couple of other tweaks.

#JavaScript, 93 85 bytes

A (rather rushed) port of Nick's Python solution.

n=>(g=x=>n--?g(x<y+~z/2n*6n+z%2n>>1n?++x:z<y/6n-~y/6n?++z-z:z=++y-y):[x,y,z])(y=z=0n)

Try It Online!

Saved 8 bytes thank to Arnauld's suggestion of using BigInts, plus a couple of other tweaks.

#JavaScript, 93 85 bytes

A port of Nick's Python solution.

n=>(g=x=>n--?g(x<y+~z/2n*6n+z%2n>>1n?++x:z<y/6n-~y/6n?++z-z:z=++y-y):[x,y,z])(y=z=0n)

Try It Online!

Saved 8 bytes thank to Arnauld's suggestion of using BigInts, plus a couple of other tweaks.

added 136 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

#JavaScript, 9393 85 bytes

A (rather rushed) port of Nick's Python solution.

n=>(g=x=>n--?g(x<y-(-~z>>1)*6+z%2>>1x<y+~z/2n*6n+z%2n>>1n?++x:(z<(yz<y/6|0)+(6n-~y/6|0)6n?++z-z:z=!++y,0)z=++y-y):[x,y,+z]z])(y=z=0y=z=0n)

Try It Online!Try It Online!

Saved 8 bytes thank to Arnauld's suggestion of using BigInts, plus a couple of other tweaks.

#JavaScript, 93 bytes

A (rather rushed) port of Nick's Python solution.

n=>(g=x=>n--?g(x<y-(-~z>>1)*6+z%2>>1?++x:(z<(y/6|0)+(-~y/6|0)?++z:z=!++y,0)):[x,y,+z])(y=z=0)

Try It Online!

#JavaScript, 93 85 bytes

A (rather rushed) port of Nick's Python solution.

n=>(g=x=>n--?g(x<y+~z/2n*6n+z%2n>>1n?++x:z<y/6n-~y/6n?++z-z:z=++y-y):[x,y,z])(y=z=0n)

Try It Online!

Saved 8 bytes thank to Arnauld's suggestion of using BigInts, plus a couple of other tweaks.

Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading