%I #75 Oct 26 2021 16:56:34
%S 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,
%T 12,38,65,93,122,5,36,9,42,76,111,147,184,222,261,301,342,384,15,59,
%U 14,60,107,8,57,107,158,210,263,317,372,428,485,17,76,136,197,259
%N 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)).
%C Do all the positive integers appear in this sequence?
%C 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.
%H Rémy Sigrist, <a href="/A348400/b348400.txt">Table of n, a(n) for n = 1..10000</a>
%H Rémy Sigrist, <a href="/A348400/a348400.gp.txt">PARI program for A348400</a>
%e a(8) = 29 and digitsum(29) = 11 is already in the sequence, so a(9) = a(8) + 8 = 29 + 8 = 37.
%e a(9) = 37 and digitsum(37) = 3 + 7 = 10 is not yet in the sequence, so a(10) = 10.
%e 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:
%e 1, 2, 4, 7, 11, 16, 22, 29, 37;
%e 10, 20, 31, 43, 56, 70, 85;
%e 13, 30;
%e 3, 22, 42;
%e 6, 28, 51, 75;
%e 12, 38, 65, 93, 122;
%e 5, 36;
%e 9, 42, 76, 111, 147, 184, 222, 261, 301, 342, 384;
%e 15, 59;
%e 14, 60, 107;
%e ...
%t 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 *)
%o (PARI) See Links section.
%Y Cf. A007953, A348483, A348433.
%K nonn,base
%O 1,2
%A _Rodolfo Kurchan_, Oct 21 2021
%E Definition clarified by _Amiram Eldar_, Oct 23 2021