|
|
A122457
|
|
a(1)=1, a(2)=1. a(n) = the sum of the two largest earlier terms which are both coprime to n.
|
|
2
|
|
|
1, 1, 2, 2, 4, 2, 6, 2, 6, 2, 12, 2, 18, 2, 6, 2, 30, 2, 48, 2, 6, 2, 78, 2, 126, 2, 6, 2, 204, 2, 330, 2, 6, 2, 282, 2, 612, 2, 6, 2, 942, 2, 1554, 2, 6, 2, 2496, 2, 3438, 2, 6, 2, 5934, 2, 9372, 2, 6, 2, 15306, 2, 24678, 2, 6, 2, 39984, 2, 64662, 2, 6, 2, 104646, 2, 169308, 2, 6
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
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
|
|
|
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:
|
|
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
|
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|