cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A238904 Smallest k such that 2^k + (2n+1) and (2n+1)*2^k + 1 are both prime, k <= n, or -1 if no such k exists.

Original entry on oeis.org

0, 1, 1, 2, 1, 1, 2, 1, -1, 6, 1, -1, 2, 2, 1, -1, 6, 1, 2, 1, 1, 2, 9, -1, 2, 1, -1, 4, 2, -1, 12, 4, 1, 2, 1, 3, 6, 3, -1, 2, 1, -1, 4, 6, 9, 8, 2, 1, 2, 1, 3, -1, 1, -1, 6, 1, -1, 12, 6, 3, 12, 8, 1, 2, 3, 3, 4, 1, -1, -1, 3, -1, -1, 60, 3, 4, 2, 1, 12
Offset: 0

Views

Author

Keywords

Examples

			a(0) = 0 because 2^0 + (2*0+1) = 2 and (2*0+1)*2^0 + 1 = 2 are both prime.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Catch@Block[{k=0}, While[k <= n, If[PrimeQ[2^k + 2*n + 1] && PrimeQ[(2*n + 1)*2^k + 1], Throw@k]; k++]; -1]; a/@ Range[0,80] (* Giovanni Resta, Mar 15 2014 *)