OFFSET
1,3
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
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
KEYWORD
nonn
AUTHOR
Leroy Quet, Mar 30 2006
EXTENSIONS
Extended by Ray Chandler, Dec 11 2006
STATUS
approved