Skip to main content
added 441 characters in body
Source Link
xnor
  • 146.6k
  • 26
  • 279
  • 652

Python 2, 43 bytes

a=b=0
for x in input():b+=a+x;a=b-a
print b

Try it online!

Takes input as a list. The update is a shorter version of a,b=b+x,a+b+x, which is like the Fibonacci update a,b=b,a+b if you ignore x.


Python 2, 45 bytes

f=lambda n,a=1,b=1:n and n%10*b+f(n/10,b,a+b)

Try it online!

Takes input as decimal numbers.

Python 2, 45 bytes

f=lambda n,a=1,b=1:n and n%10*b+f(n/10,b,a+b)

Try it online!

Takes input as decimal numbers.

Python 2, 43 bytes

a=b=0
for x in input():b+=a+x;a=b-a
print b

Try it online!

Takes input as a list. The update is a shorter version of a,b=b+x,a+b+x, which is like the Fibonacci update a,b=b,a+b if you ignore x.


Python 2, 45 bytes

f=lambda n,a=1,b=1:n and n%10*b+f(n/10,b,a+b)

Try it online!

Takes input as decimal numbers.

Source Link
xnor
  • 146.6k
  • 26
  • 279
  • 652

Python 2, 45 bytes

f=lambda n,a=1,b=1:n and n%10*b+f(n/10,b,a+b)

Try it online!

Takes input as decimal numbers.