login
a(0)=1; a(n) = Sum_{j<n, gcd(n,a(j)) = 1} a(j).
2

%I #19 Jun 12 2024 23:46:07

%S 1,1,2,4,2,10,2,22,2,46,2,72,2,168,2,88,2,428,2,858,2,620,2,2294,2,

%T 4006,2,7546,2,16192,2,29472,2,7442,2,60960,2,127972,2,38738,2,296980,

%U 2,593962,2,798786,2,1986714,2,3926978,2,5023380,2,12923792,2,16513952

%N a(0)=1; a(n) = Sum_{j<n, gcd(n,a(j)) = 1} a(j).

%C For j > 0, a(2j) = 2 and a(j+1) is even.

%H John Tyler Rascoe, <a href="/A055935/b055935.txt">Table of n, a(n) for n = 0..1000</a>

%e a(9) = 46 because all previous terms are relatively prime to 9 and the sum of all previous terms is 46.

%o (Python)

%o from math import gcd

%o def A055935_list(nmax):

%o A = [1,1]

%o for n in range(2,nmax+1):

%o if n%2 > 1:

%o A.append(2)

%o else:

%o A.append(sum(i for i in A if gcd(n,i) ==1))

%o return A # _John Tyler Rascoe_, Jun 12 2024

%Y Cf. A055934.

%K easy,nonn

%O 0,3

%A _Leroy Quet_, Jul 17 2000