login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A106821 Greatest k < n such that 2^n - 2^k -1 is prime or 0 if no such prime exists. 5

%I #19 Feb 23 2018 23:30:25

%S 0,0,2,3,3,5,0,7,7,5,3,9,11,13,0,11,11,17,11,19,17,16,0,21,13,9,0,23,

%T 17,18,0,31,23,28,31,34,0,33,0,38,31,37,0,30,43,17,31,45,41,37,7,47,

%U 41,44,0,42,55,0,27,42,43,61,0,29

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

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

%e 2^3 - 2^2 -1 = 3 prime so a(3)=2

%e 2^4 - 2^3 -1 = 7 prime so a(4)=3

%e 2^5 - 2^3 -1 = 23 prime so a(5)=3

%e 2^6 - 2^5 -1 = 31 prime so a(6)=5

%t kk[n_]:=Module[{k=n-1,n2=2^n},While[!PrimeQ[n2-2^k-1]&&k>0,k--];k]; Array[kk,70] (* _Harvey P. Dale_, Mar 09 2012 *)

%o (PARI)

%o for(n=1,1000, q=1;

%o forstep(k=n-1,0,-1,

%o if(isprime(2^n-2^k-1),

%o q=0;

%o print1(k,", ");

%o break()

%o )

%o );

%o if(q,print1(0,", "))

%o ) /* Joerg Arndt, Jan 14 2011 */

%K nonn

%O 1,3

%A _Pierre CAMI_, May 18 2005

%E Extra numbers to right of data removed from b-file by _Andrew Howroyd_, Feb 23 2018

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 22:17 EDT 2024. Contains 371964 sequences. (Running on oeis4.)