VOOZH about

URL: https://oeis.org/A122847

⇱ A122847 - OEIS


login
A122847
a(0)=0. a(n) = a(n-1) + (sum of positive integers which are coprime to n, <= n and missing from {a(0),a(1),a(2),..,a(n-1)}).
2
0, 1, 1, 3, 3, 9, 14, 31, 43, 69, 76, 118, 141, 206, 235, 280, 331, 440, 493, 637, 704, 829, 926, 1152, 1247, 1470, 1613, 1841, 1996, 2375, 2494, 2932, 3144, 3428, 3656, 4032, 4216, 4824, 5122, 5544, 5820, 6582, 6802, 7647, 8000, 8451, 8870, 9850, 10159
OFFSET
0,4
LINKS
EXAMPLE
The positive integers which are coprime to 8 and <= 8 are 1,3,5,7. Of these, 5 and 7 are missing from the terms a(0) through a(7). So a(8) = a(7) + 5 + 7 = 43.
MAPLE
S:= {0}:
R:= 0: r:= 0:
for n from 1 to 100 do
r:= r + convert(select(t -> igcd(t, n) = 1, {$1 .. n} minus S), `+`);
R:= R, r;
S:= S union {r};
od:
R; # Robert Israel, Mar 10 2025
MATHEMATICA
f[l_List] := Block[{n = Length[l]}, Append[l, l[[ -1]] + Plus @@ Select[Range[n], GCD[n, # ] == 1 && FreeQ[l, # ] &]]]; Nest[f, {0}, 50] (* Ray Chandler, Oct 26 2006 *)
s={0, 1}; b=1; Do[ b=b+Total[ Select[ Range[ n ], GCD[ #1, n ]==1&&FreeQ[ s, #1 ]& ] ]; AppendTo[ s, b ], {n, 2, 100} ]; s (* Zak Seidov, Oct 26 2006 *)
CROSSREFS
Cf. A122965.
Sequence in context: A052436 A243790 A267296 * A383827 A383806 A383496
KEYWORD
nonn
AUTHOR
Leroy Quet, Oct 23 2006
EXTENSIONS
Extended by Ray Chandler and Zak Seidov, Oct 26 2006
STATUS
approved