login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Numbers k such that the exponent of highest power of 2 dividing k! equals the largest prime < k.
4

%I #26 Jul 10 2022 17:31:25

%S 4,5,8,9,22,23,26,27,32,33,50,51,56,57,70,71,76,77,82,83,94,95,100,

%T 101,112,113,118,119,128,129,134,135,176,177,186,187,196,197,266,267,

%U 274,275,280,281,296,297,342,343,352,353,358,359,364,365,372,373,386,387

%N Numbers k such that the exponent of highest power of 2 dividing k! equals the largest prime < k.

%C [k/2]+[k/4]+[k/8]+[k/16]+... = prevprime(k).

%H Alois P. Heinz, <a href="/A064394/b064394.txt">Table of n, a(n) for n = 1..10000</a> (first 1001 terms from Harvey P. Dale)

%F A011371(a(n)) = A151799(a(n)).

%e 8! = 2^7*3^2*5*7, 23! = 2^19*3^9*5^4*7^3*11^2*13*17*19*23.

%p for n from 3 to 10^3 do if sum(floor(n/(2^i)), i=1..15) = prevprime(n) then printf(`%d,`,n) fi; od:

%p # second Maple program:

%p b:= proc(n) option remember;

%p `if`(n<1, 0, b(n-1)+padic[ordp](n, 2))

%p end:

%p a:= proc(n) option remember; local k; for k from 1+

%p `if`(n=1, 2, a(n-1)) while b(k)<>prevprime(k) do od; k

%p end:

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Jul 10 2022

%t Select[Range[400],IntegerExponent[#!,2]==NextPrime[#,-1]&] (* _Harvey P. Dale_, Sep 24 2013 *)

%o (Python 3.10+)

%o from itertools import count, islice

%o from sympy import prevprime

%o def A064394_gen(startvalue=3): # generator of terms

%o return filter(lambda n:n-n.bit_count()==prevprime(n),count(max(startvalue,3)))

%o A064394_list = list(islice(A064394_gen(),30)) # _Chai Wah Wu_, Jul 10 2022

%o (PARI) isok(k) = (k>1) && (valuation(k!,2) == precprime(k-1)); \\ _Michel Marcus_, Jul 10 2022

%Y Cf. A000040, A011371, A064393, A151799.

%K nonn

%O 1,1

%A _Vladeta Jovovic_, Sep 29 2001

%E More terms from _James A. Sellers_, Oct 01 2001

%E Name clarified and offset changed to 1 by _Chai Wah Wu_, Jul 10 2022