A348400 a(1) = 1; a(n+1) = a(n) + n if the digit sum of a(n) is already in the sequence, otherwise a(n+1) = digitsum(a(n)).
1, 2, 4, 7, 11, 16, 22, 29, 37, 10, 20, 31, 43, 56, 70, 85, 13, 30, 3, 22, 42, 6, 28, 51, 75, 12, 38, 65, 93, 122, 5, 36, 9, 42, 76, 111, 147, 184, 222, 261, 301, 342, 384, 15, 59, 14, 60, 107, 8, 57, 107, 158, 210, 263, 317, 372, 428, 485, 17, 76, 136, 197, 259
Offset: 1
Examples
a(8) = 29 and digitsum(29) = 11 is already in the sequence, so a(9) = a(8) + 8 = 29 + 8 = 37. a(9) = 37 and digitsum(37) = 3 + 7 = 10 is not yet in the sequence, so a(10) = 10. Written as an irregular triangle, in which each line begins with a term which is the digit sum of its preceding term, the sequence begins: 1, 2, 4, 7, 11, 16, 22, 29, 37; 10, 20, 31, 43, 56, 70, 85; 13, 30; 3, 22, 42; 6, 28, 51, 75; 12, 38, 65, 93, 122; 5, 36; 9, 42, 76, 111, 147, 184, 222, 261, 301, 342, 384; 15, 59; 14, 60, 107; ...
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..10000
- Rémy Sigrist, PARI program for A348400
Programs
-
Mathematica
seq[len_] := Module[{s = {1}, k, d, i = 1}, While[Length[s] < len, k = s[[-1]]; If[MemberQ[s, (d = Plus @@ IntegerDigits[k])], AppendTo[s, k + i], AppendTo[s, d]]; i++]; s]; seq[50] (* Amiram Eldar, Oct 21 2021 *)
-
PARI
See Links section.
Extensions
Definition clarified by Amiram Eldar, Oct 23 2021
Comments