login
A292599
a(1) = 0; for n > 1, a(n) = A010051(n) + 2*a(floor(n/2)).
4
0, 1, 1, 2, 3, 2, 3, 4, 4, 6, 7, 4, 5, 6, 6, 8, 9, 8, 9, 12, 12, 14, 15, 8, 8, 10, 10, 12, 13, 12, 13, 16, 16, 18, 18, 16, 17, 18, 18, 24, 25, 24, 25, 28, 28, 30, 31, 16, 16, 16, 16, 20, 21, 20, 20, 24, 24, 26, 27, 24, 25, 26, 26, 32, 32, 32, 33, 36, 36, 36, 37, 32, 33, 34, 34, 36, 36, 36, 37, 48, 48, 50, 51, 48, 48, 50, 50, 56, 57, 56, 56, 60, 60, 62, 62, 32
OFFSET
1,4
COMMENTS
1-bits in base-2 expansion of a(n) indicate the positions of primes in the sequence [n, floor(n/2), floor(n/4), ..., 1].
FORMULA
a(1) = 0; for n > 1, a(n) = A010051(n) + 2*a(floor(n/2)).
Other identities. For all n >= 1:
A000120(a(n)) = A078349(n).
A007814(1+a(n)) = A292936(n).
MAPLE
A292599 := proc(n)
option remember;
if n = 1 then
0 ;
else
A010051(n) + 2*procname(floor(n/2)) ;
end if;
end proc:
seq(A292599(n), n=1..100) ; # R. J. Mathar, Sep 28 2017
MATHEMATICA
a[1] = 0; a[n_] := a[n] = Boole[PrimeQ[n]] + 2*a[Floor[n/2]]; Array[a, 96] (* Jean-François Alcover, Sep 29 2017 *)
PROG
(Scheme, with memoization-macro definec)
(definec (A292599 n) (if (<= n 1) 0 (+ (A010051 n) (* 2 (A292599 (floor->exact (/ n 2)))))))
CROSSREFS
Cf. also A292596 (variant for odd primes).
Sequence in context: A336264 A070770 A377092 * A071487 A124071 A034697
KEYWORD
nonn
AUTHOR
Antti Karttunen, Sep 27 2017
STATUS
approved