OFFSET
0,1
EXAMPLE
a(5) = 13 because 1 + 3 = 4, 3 + 4 = 7, 4 + 7 = 11, 7 + 11 = 18 that is 13 + 5.
MAPLE
with(numtheory): P:=proc(q, h) local a, b, c, j, k, n, t, v; v:=array(1..h); c:=[];
for j from 0 to 59 do for n from 10 to q do a:=n; b:=length(a);
for k from 1 to b do v[b-k+1]:=(a mod 10); a:=trunc(a/10); od; t:=b+1; v[t]:=add(v[k], k=1..b);
while v[t]<n+j do t:=t+1; v[t]:=add(v[k], k=t-b..t-1); od; if v[t]=n+j then c:=[op(c), n]; break;
fi; od; od; op(c); end: P(10^6, 5000);
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Paolo P. Lava, Oct 27 2024
STATUS
approved