login
a(1) = 1; a(n+1) = Sum_{k=1..n} {q(a(k)): q(a(k)) = q(a(n))}, where q(n) = A007953(n) + A055642(n).
2

%I #17 Sep 08 2022 08:46:24

%S 1,2,3,4,5,6,7,8,9,10,6,14,21,10,9,20,8,18,11,12,15,16,27,22,12,20,16,

%T 36,33,24,32,28,12,25,45,44,30,30,35,40,18,55,24,40,24,48,14,35,50,42,

%U 56,13,30,40,36,66,28,36,77,16,54

%N a(1) = 1; a(n+1) = Sum_{k=1..n} {q(a(k)): q(a(k)) = q(a(n))}, where q(n) = A007953(n) + A055642(n).

%C a(n+1) = k(n)*q(a(n)), where k(n) is the number of times (up to and including a(n)) that a term having the same q-value as a(n) has occurred in the sequence so far.

%H Amiram Eldar, <a href="/A330814/b330814.txt">Table of n, a(n) for n = 1..10000</a>

%e a(2) is q(a(1))=a(1)=2; a(10)=q(10)=3, and 3=q(a(2)) has been seen once before, so a(11)=3+3=6.

%t s[n_] := Plus @@(d = IntegerDigits[n]) + Length[d]; a[1] = 1; a[n_] := a[n] = (s1 = s[a[n - 1]])*(1 + Sum[Boole[s[a[k]] == s1], {k, 1, n - 2}]); Array[a, 100] (* _Amiram Eldar_, Jan 01 2020 *)

%o (Magma) q:=func<n|&+Intseq(n)+#Intseq(n)>; a:=[1,2]; for n in [3..70] do Append( ~a,&+[ q(a[k-1]):k in [2..n]| q(a[k-1]) eq q(a[n-1])]); end for; a; // _Marius A. Burtea_, Jan 02 2020

%Y Cf. A279818, A330807, A007953, A055642.

%K nonn,base

%O 1,2

%A _David James Sycamore_, Jan 01 2020