login
A112479
a(n) = 1 + sum{p=primes<n, p does not divide n} a(p).
1
1, 1, 2, 3, 4, 5, 8, 15, 14, 11, 16, 29, 32, 55, 58, 63, 64, 125, 128, 251, 246, 239, 256, 509, 508, 479, 510, 503, 512, 1017, 1024, 2047, 2030, 1983, 2036, 2045, 2048, 3967, 4062, 4091, 4096, 8181, 8192, 16367, 16378, 16127, 16384, 32765, 32760, 32763
OFFSET
1,3
COMMENTS
a(prime(k)) = 2^(k-1). - Ivan Neretin, May 01 2016
LINKS
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
Sequence in context: A140294 A108014 A075721 * A333264 A247461 A281303
KEYWORD
nonn
AUTHOR
Leroy Quet, Dec 13 2005
EXTENSIONS
Extended by Ray Chandler, Dec 26 2005
STATUS
approved