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.

A016014 Least k such that 2*n*k + 1 is a prime.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 3, 2, 1, 1, 3, 3, 1, 5, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 5, 3, 1, 2, 1, 1, 2, 3, 1, 3, 1, 4, 2, 1, 2, 3, 3, 1, 2, 1, 1, 3, 1, 1, 3, 1, 2, 2, 6, 2, 3, 3, 1, 2, 1, 3, 2, 1, 1, 2, 4, 3, 2, 1, 1, 3, 3, 1, 2, 4, 1, 5, 1, 2, 6, 1, 2, 2, 1, 1, 3, 7, 2, 5, 1, 1, 2, 1, 1
Offset: 1

Views

Author

Keywords

Comments

Is the sequence bounded? - Zak Seidov, Mar 25 2014
Answer: No, for any given N a number n such that a(n) > N can be constructed by the Chinese Remainder Theorem, see A239727. - Charles R Greathouse IV, Mar 25 2014
a(n) = 1 for n in A005097. - Robert Israel, Oct 26 2016

Crossrefs

A070846 contains the corresponding primes.
Records are in A239746 with indices in A239727.

Programs

  • Maple
    f:= proc(n) local k;
         for k from 1 do if isprime(2*n*k+1) then return k fi od
    end proc:
    map(f, [$1..100]); # Robert Israel, Oct 26 2016
  • Mathematica
    Do[k = 1; cp = n*k + 1; While[ ! PrimeQ[cp], k++; cp = n*k + 1]; Print[k], {n, 2, 400, 2}] (* Lei Zhou, Feb 23 2005 *)
    lk[n_]:=Module[{k=1},While[!PrimeQ[2n k+1],k++];k]; Array[lk,100] (* Harvey P. Dale, Apr 23 2023 *)
  • PARI
    a(n)=my(k); while(!isprime(2*n*(k++)+1),);k \\ Charles R Greathouse IV, Mar 25 2014
    
  • Python
    from sympy import isprime
    def a(n):
        k = 1
        while not isprime(2*n*k + 1): k += 1
        return k
    print([a(n) for n in range(1, 100)]) # Michael S. Branicky, Mar 28 2022