login
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)).
4
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,2
COMMENTS
Do all the positive integers appear in this sequence?
With 10^6 terms, 87, 89, 90, 91, 92, 94, 95, 96, 97, 98, 101, 102, 103, 104, 105, 106, 108, 109, 110, 112 are the smallest numbers that still are not in the sequence.
LINKS
EXAMPLE
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;
...
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 *)
PROG
(PARI) See Links section.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rodolfo Kurchan, Oct 21 2021
EXTENSIONS
Definition clarified by Amiram Eldar, Oct 23 2021
STATUS
approved