|
|
A179622
|
|
n such that n is the sum of previous numbers found using n's digits as offsets.
|
|
1
|
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 19, 18, 28, 27, 37, 36, 46, 45, 55, 46, 91, 101, 92, 137, 147, 138, 183, 193, 184, 138, 321, 331, 322, 276, 459, 469, 460, 414, 597, 459, 928, 919, 873, 1056, 918, 1387, 1378, 1332, 1515, 1056, 1974, 2443, 2434
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,11
|
|
LINKS
|
|
|
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)
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
(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')
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|