OFFSET
1,1
COMMENTS
[k/2]+[k/4]+[k/8]+[k/16]+... = prevprime(k+1).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000 (first 1001 terms from Harvey P. Dale)
EXAMPLE
4! = 2^3*3, 8! = 2^7*3^2*5*7, 9! = 2^7*3^4*5*7, 22! = 2^19*3^9*5^4*7^3*11^2*13*17*19.
MAPLE
for n from 3 to 10^3 do if sum(floor(n/(2^i)), i=1..15) = prevprime(n+1) then printf(`%d, `, n) fi; od:
# second Maple program:
b:= proc(n) option remember;
`if`(n<1, 0, b(n-1)+padic[ordp](n, 2))
end:
a:= proc(n) option remember; local k; for k from 1+
`if`(n=1, 2, a(n-1)) while b(k)<>prevprime(k+1) do od; k
end:
seq(a(n), n=1..100); # Alois P. Heinz, Jul 10 2022
MATHEMATICA
f[n_] := (t = 0; p = 2; While[s = Floor[n/p]; t = t + s; s > 0, p *= 2]; t); Do[ If[ f[n] == Prime[ PrimePi[n]], Print[n]], {n, 2, 500} ]
lp[n_]:=If[PrimeQ[n], n, NextPrime[n, -1]]; Select[Range[460], IntegerExponent[ #!, 2] == lp[#]&] (* Harvey P. Dale, Mar 02 2014 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladeta Jovovic, Sep 29 2001
EXTENSIONS
More terms from Robert G. Wilson v and James A. Sellers, Oct 01 2001
Offset changed to 1 by Alois P. Heinz, Jul 10 2022
STATUS
approved