OFFSET
1,3
COMMENTS
a(prime(k)) = 2^(k-1). - Ivan Neretin, May 01 2016
LINKS
Ivan Neretin, Table of n, a(n) for n = 1..1001
EXAMPLE
a(9) = 1 + a(2) + a(5) + a(7), since 2, 5 and 7 are the primes < 9 and coprime to 9. So a(9) = 1 + 1 + 4 + 8
= 14.
MATHEMATICA
f[l_] := Block[{n}, n = Length[l] + 1; Return[Append[l, 1 + Plus @@ l[[Select[Range[n - 1], PrimeQ[ # ] && Mod[n, # ] > 0 &]]]]]; ]; Nest[f, {1}, 50] (* Ray Chandler, Dec 26 2005 *)
PROG
(PARI) a(n)=if(n<7, max(n-1, 1), my(s=1); forprime(p=2, n-1, if(n%p, s+=a(p))); s) \\ Charles R Greathouse IV, May 02 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Dec 13 2005
EXTENSIONS
Extended by Ray Chandler, Dec 26 2005
STATUS
approved