Skip to main content
Commonmark migration
Source Link

#Ruby, 26 bytes#

Ruby, 26 bytes

anonymous function with iteration.

->n{a=1;n.times{a^=a*2};a}

this recursive function is one byte shorter, but as it needs to be named to be able to refer to itself, it ends up one byte longer.

f=->n{n<1?1:(s=f[n-1])^s*2}

#Ruby, 26 bytes#

anonymous function with iteration.

->n{a=1;n.times{a^=a*2};a}

this recursive function is one byte shorter, but as it needs to be named to be able to refer to itself, it ends up one byte longer.

f=->n{n<1?1:(s=f[n-1])^s*2}

Ruby, 26 bytes

anonymous function with iteration.

->n{a=1;n.times{a^=a*2};a}

this recursive function is one byte shorter, but as it needs to be named to be able to refer to itself, it ends up one byte longer.

f=->n{n<1?1:(s=f[n-1])^s*2}
Source Link
Level River St
  • 26.7k
  • 4
  • 37
  • 105

#Ruby, 26 bytes#

anonymous function with iteration.

->n{a=1;n.times{a^=a*2};a}

this recursive function is one byte shorter, but as it needs to be named to be able to refer to itself, it ends up one byte longer.

f=->n{n<1?1:(s=f[n-1])^s*2}