OFFSET
1,11
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..6588
FORMULA
For n < 10, a(n) = 1.
For n >= 10, a(n) = a(n - first nonzero digit of n) + a(n - second nonzero digit of n) + ... + a(n - last nonzero digit of n).
EXAMPLE
a(10) = a(10 - 1), nonzero digits in n are skipped.
a(12) = a(12 - 1) + a(12 - 2).
a(312) = a(312 - 3) + a(312 - 1) + a(312 - 2).
MATHEMATICA
a[1] = a[2] = a[3] = a[4] = a[5] = a[6] = a[7] = a[8] = a[9] = 1; a[n_] := Block[{s = Select[ IntegerDigits@ n, # > 0 &]}, Plus @@ (a[n - # ] & /@ s)]; Array[a, 63] (* Robert G. Wilson v, Aug 23 2010 *)
PROG
(Python)
def A179622(up_to_n):
sequence=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
for n in range(len(sequence), up_to_n+1):
seed_of_new_element=[-int(x) for x in str(n).replace("0", "")]
new_element=sum(list(map(sequence.__getitem__, seed_of_new_element)))
sequence.append(new_element)
return sequence
A179622(63) # Bence BernĂ¡th, Nov 08 2022
(Python)
from functools import cache
@cache
def a(n): return 1 if n<10 else sum(a(n-int(i)) for i in str(n) if i!='0')
print([a(n) for n in range(1, 81)]) # Michael S. Branicky, Nov 12 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Dominick Cancilla, Jul 20 2010
STATUS
approved