OFFSET
1,2
LINKS
Paolo P. Lava and Giovanni Resta, Table of n, a(n) for n = 1..10000 (first 100 terms from Paolo P. Lava)
EXAMPLE
Starting with a(1)=1, the minimum number a(2)>a(1) such that a(1) U a(2) is a Niven number is 2. In fact 12 / 3 = 4.
Again, the minimum a(3)>a(2) such that a(1) U a(2) U a(3) is a Niven number is 6. In fact 126 / 9 = 14. Etc.
MAPLE
with(numtheory);
S:=proc(s) local w; w:=convert(s, base, 10); sum(w[j], j=1..nops(w)); end:
T:=proc(t) local w, x, y; x:=t; y:=0; while x>0 do x:=trunc(x/10); y:=y+1; od; end:
P:=proc(q) local a, b, c, j, n; a:=1; j:=1; print(1);
for n from 1 to q do b:=T(j); c:=a*10^b+j;
if type(c/S(c), integer) then a:=a*10^b+j; print(j); fi;
j:=j+1; od; print(); end: P(10^6);
MATHEMATICA
Nest[Append[#, Block[{k = Last@ # + 1}, While[! Divisible[FromDigits@ #, Total[#]] &[Flatten@ Map[IntegerDigits, #]~Join~IntegerDigits@ k], k++]; k]] &, {1}, 49] (* Michael De Vlieger, Dec 23 2017 *)
PROG
(PARI) ok(v, n, m) = {vd = []; for (k=1, n-1, vd = concat(vd, digits(v[k])); ); vd = concat(vd, digits(m)); svd = vecsum(vd); ivd = fromdigits(vd); ivd % svd == 0; }
lista(nn) = {v = vector(nn); v[1] = 1; for (n=2, nn, m = v[n-1]+1; while(!ok(v, n, m), m++); v[n] = m; ); v; } \\ Michel Marcus, Dec 21 2017
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Paolo P. Lava, Mar 21 2014
STATUS
approved