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.

A076806 Minimal odd k such that k*2^n-1 and k*2^n+1 are twin primes.

Original entry on oeis.org

3, 1, 9, 15, 81, 3, 9, 57, 45, 15, 99, 165, 369, 45, 345, 117, 381, 3, 69, 447, 81, 33, 1179, 243, 765, 375, 81, 387, 45, 345, 681, 585, 375, 267, 741, 213, 429, 3093, 165, 267, 255, 1095, 9, 147, 849, 405, 1491, 177, 1941, 927, 1125, 1197, 2001, 333, 519
Offset: 1

Views

Author

Andrey V. Kulsha, Nov 18 2002

Keywords

Examples

			a(4)=15 because k*2^4-1 and k*2^4+1 are twin primes for k=15 and are not twin primes for smaller odd k.
		

Crossrefs

Cf. A063983.

Programs

  • Magma
    a:=[]; for n in [1..55] do k:=1; while not (IsPrime(k*2^n-1) and IsPrime(k*2^n+1)) do k:=k+2; end while; Append(~a,k); end for; a; // Marius A. Burtea, Nov 16 2019
  • Mathematica
    f[n_] := Block[{k = 1}, While[ !PrimeQ[k*2^n - 1] || !PrimeQ[k*2^n + 1], k += 2]; k]; Array[f, 50]
    mok[n_]:=Module[{n2=2^n,k=1},While[!AllTrue[k*n2+{1,-1},PrimeQ],k=k+2];k]; Array[mok,60] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, May 19 2015 *)
  • PARI
    for(n=1, 100, N=2^n; forstep(k=1, 10^100, 2, if(isprime(k*N-1) && isprime(k*N+1), print1(k, ", "); break)))
    
  • Sage
    A076806 = lambda n: next(k for k in IntegerRange(1, infinity, 2) if is_prime(k*2**n-1) and is_prime(k*2**n+1)) # D. S. McNeil, Dec 08 2010