A078349 Number of primes in sequence h(m) defined by h(1) = n, h(m+1) = Floor(h(m)/2).
0, 1, 1, 1, 2, 1, 2, 1, 1, 2, 3, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 3, 4, 1, 1, 2, 2, 2, 3, 2, 3, 1, 1, 2, 2, 1, 2, 2, 2, 2, 3, 2, 3, 3, 3, 4, 5, 1, 1, 1, 1, 2, 3, 2, 2, 2, 2, 3, 4, 2, 3, 3, 3, 1, 1, 1, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 3, 2, 2, 3, 4, 2, 2, 3, 3, 3, 4, 3, 3, 4, 4, 5, 5, 1, 2, 1, 1, 1
Offset: 1
Keywords
Examples
The sequence h(m) for n = 5 is 5, 2, 1, 0, 0, 0, ...., in which two terms are primes. Therefore a(5) = 2.
Links
- Antti Karttunen, Table of n, a(n) for n = 1..16384
Programs
-
Mathematica
f[n_] := Module[{i, p}, i = n; p = 0; While[i > 1, If[PrimeQ[i], p = p + 1]; i = Floor[i/2]]; p]; Table[f[i], {i, 1, 100}]
-
PARI
A078349(n) = if(1==n,0,isprime(n)+A078349(n\2)); \\ Antti Karttunen, Oct 01 2017
Comments