OFFSET
1,2
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
EXAMPLE
n = 2, s = 1; k = 2: s+k = 3 is divisible by 3, hence a(2) = 2.
n = 3, s = 1+2 = 3; k = 3: s+k = 6 is divisible by 6, hence a(3) = 3.
n = 4, s = 1+2+3 = 6; k = 4: s+k = 10 is divisible by 1+0 = 1, hence a(4) = 4.
n = 5, s = 1+2+3+4 = 10; k = 5: s+k = 15 is not divisible by 1+5 = 6; k = 6: s+k = 16 is not divisible by 1+6 = 7; k = 7: s+k = 17 is not divisible by 1+7 = 8; k = 8: s+k = 18 is divisible by 1+8 = 9, hence a(5) = 8.
MATHEMATICA
Nest[Append[#, Block[{k = Last@ # + 1}, While[! Divisible[#, Total[IntegerDigits[#]]] &[k + Total@ #], k++]; k]] &, {1}, 59] (* Michael De Vlieger, Dec 23 2017 *)
PROG
(PARI) {digitsum(n) = local(s=0, d); while(n>0, d=divrem(n, 10); n=d[1]; s+=d[2]); s}
{m=60; print1(1, ", "); s=1; k=2; for(n=2, m, while((a=s+k)%digitsum(a)>0, k++); print1(k, ", "); s=a; k++)} /* Klaus Brockhaus, Aug 28 2007 */
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Philippe Lallouet (philip.lallouet(AT)wanadoo.fr), Aug 20 2007
EXTENSIONS
Edited, corrected and extended by Klaus Brockhaus, Aug 28 2007
STATUS
approved