OFFSET
1,3
COMMENTS
From Robert Israel, Jun 07 2018: (Start)
For n >= 4, a(n) = 2 if n is even.
For n >= 7, a(n) == 0 (mod 6) if n is odd.
For n >= 9, a(n) = 6 if n == 3 (mod 6). (End)
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1)=1, a(2)=1, a(3)=2, a(4)=2, a(5)=4, a(6)=2, a(8)=2 are the terms which are coprime to 9 and which occur among {a(1),a(2)...a(8)}. 2 and 4 are the two largest of these terms, so a(9) = 2 + 4 = 6.
MAPLE
N:= 100: # for a(1)..a(N)
V[1]:= 1: V[2]:= 1:
for n from 3 to N do
Q:= select(t -> igcd(t, n)=1, [seq(V[i], i=1..n-1)]);
j1:= max[index](Q);
V[n]:= Q[j1] + max(subsop(j1=NULL, Q))
od:
seq(V[i], i=1..N); # Robert Israel, Jun 07 2018
MATHEMATICA
f[s_] := Append[s, Plus @@ Take[Sort[Select[s, GCD[ #, Length[s] + 1] == 1 &]], -2]]; Nest[f, {1, 1}, 74] (* Ray Chandler, Sep 11 2006 *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Leroy Quet, Sep 07 2006
EXTENSIONS
Corrected and extended by Ray Chandler and Robert G. Wilson v, Sep 11 2006
STATUS
approved