login
A130804
a(1) = 1; for n > 1, a(n) = smallest k > a(n-1) such that s+k is divisible by sum of digits of (s+k), where s = Sum_{j=1..n-1} a(j).
2
1, 2, 3, 4, 8, 9, 13, 14, 16, 20, 21, 22, 23, 24, 27, 33, 40, 42, 48, 50, 56, 64, 65, 79, 86, 94, 96, 102, 106, 107, 111, 114, 120, 124, 128, 129, 132, 135, 140, 148, 154, 170, 171, 180, 185, 194, 206, 207, 217, 224, 234, 237, 245, 252, 259, 269, 280, 294, 306, 310
OFFSET
1,2
LINKS
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
Cf. A007953 (sum of digits of n).
Sequence in context: A364810 A335761 A127483 * A022999 A244151 A057844
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