login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A117892
Add up the positive integers which are coprime to n in order (starting at 1). a(n) is the largest such partial sum that is <= n.
3
1, 1, 3, 4, 3, 6, 6, 4, 7, 4, 10, 6, 10, 9, 14, 16, 15, 13, 15, 20, 20, 16, 21, 24, 23, 25, 27, 18, 28, 19, 28, 25, 27, 25, 33, 24, 36, 36, 37, 31, 36, 30, 36, 38, 33, 36, 45, 37, 48, 44, 48, 51, 45, 54, 52, 42, 48, 49, 55, 49, 55, 49, 54, 64, 63, 62, 66, 64, 61, 54, 66, 54, 66
OFFSET
1,3
LINKS
EXAMPLE
12 is coprime to 1, 5, 7, 11,... Now 1 = 1, 1+5 = 6, 1+5+7 = 13, 1+5+7+11 = 24, ... 6 is the highest such partial sum that is <= 12. So a(12) = 6.
MATHEMATICA
f[n_] := Block[{k = 1, t, s}, While[t = Plus @@ Select[Range[k], GCD[ #, n] == 1 &]; t <= n, s = t; k++ ]; s]; Table[f[n], {n, 80}] (* Ray Chandler, Dec 11 2006 *)
lps[n_]:=Select[Reverse[Accumulate[Select[Range[n], CoprimeQ[#, n]&]]], #<=n&, 1]; Flatten[Array[lps, 80]] (* Harvey P. Dale, Nov 22 2013 *)
CROSSREFS
Sequence in context: A197699 A005092 A136195 * A286098 A074372 A331372
KEYWORD
nonn
AUTHOR
Leroy Quet, Mar 30 2006
EXTENSIONS
Extended by Ray Chandler, Dec 11 2006
STATUS
approved