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!)
A276417 a(n) = least positive k such that (2*n + 1) - 2^k is prime, or 0 if no such k exists. 2
0, 0, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 4, 1, 1, 2, 3, 1, 2, 1, 1, 2, 1, 2, 4, 1, 2, 4, 1, 1, 2, 3, 1, 2, 1, 1, 2, 3, 1, 2, 1, 2, 4, 1, 2, 4, 3, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 4, 3, 4, 4, 0, 1, 2, 1, 2, 6, 1, 1, 2, 3, 3, 0, 1, 1, 2, 3, 1, 2, 5, 1, 2, 1, 2, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,6
COMMENTS
a(n) = 1 iff n is in A006254. - Robert Israel, Sep 02 2016
For n > 1, a(n) = 0 iff 2n+1 is de Polignac number, A006285. - Thomas Ordowski, Apr 13 2017
LINKS
FORMULA
If A188903(n) >= 2, then a(n) = log_2(A188903(n)), otherwise a(n) = 0.
EXAMPLE
a(14) = 4 because (2*14 + 1) - 2^k is composite for k = 1, 2, 3 and prime for k = 4.
MAPLE
f:= proc(n) local k;
for k from 1 do
if 2*n < 2^k then return 0
elif isprime(2*n+1-2^k) then return k
fi
od
end proc:
map(f, [$0..100]); # Robert Israel, Sep 02 2016
MATHEMATICA
Table[If[n <= 2, 0, k = 1; While[! PrimeQ[2 n + 1 - 2^k], k++]; k], {n, 0, 120}] (* Michael De Vlieger, Sep 03 2016 *)
PROG
(Magma) lst:=[]; for n in [1..173 by 2] do k:=0; c:=k; repeat k+:=1; c+:=1; a:=n-2^k; until a lt 1 or IsPrime(a); if a lt 1 then Append(~lst, 0); else Append(~lst, c); end if; end for; lst;
(PARI) a(n) = my(k=1); while(2^k < 2*n+1, if(ispseudoprime((2*n+1)-2^k), return(k)); k++); return(0) \\ Felix Fröhlich, Sep 02 2016
CROSSREFS
Sequence in context: A161109 A161044 A029325 * A025432 A025433 A025434
KEYWORD
nonn
AUTHOR
STATUS
approved

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 May 2 07:19 EDT 2024. Contains 372178 sequences. (Running on oeis4.)