login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A179013 Greatest k <= n such that 2^n-2^k+1 is prime, or 0 if no such prime exists. 4

%I

%S 0,1,2,2,4,2,5,6,8,8,5,2,9,12,9,12,16,0,12,18,0,2,20,18,18,16,21,16,

%T 26,18,27,30,20,22,19,20,25,36,23,32,37,38,41,38,9,38,25,44,41,44,17,

%U 48,50,38,52,32,38,34,48,18,54

%N Greatest k <= n such that 2^n-2^k+1 is prime, or 0 if no such prime exists.

%C For the first 8300 terms, there are 291 values of n such that a(n)=0 and 6927 values of n with a(n) >= n/2.

%H Pierre CAMI, <a href="/A179013/b179013.txt">Table of n, a(n) for n = 1..10000</a>

%t Table[k=n; While[k>0 && ! PrimeQ[2^n-2^k+1], k--]; k, {n, 100}]

%o (Sage)

%o A179013 = lambda n: next((k for k in reversed([1..floor(log(2**n+1,2))]) if is_pseudoprime(2**n-2**k+1)), 0) # _D. S. McNeil_, Jan 12 2011

%o (PARI) a(n) = {my(k=n); while (!isprime(2^n-2^k+1), k--; if (k==0, return (0))); k;} \\ _Michel Marcus_, Sep 21 2019

%Y Cf. A106821, A178993.

%K nonn

%O 1,3

%A _Pierre CAMI_, Jan 12 2011

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 20 02:21 EDT 2020. Contains 337261 sequences. (Running on oeis4.)