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.

This page as a plain text file.
%I A016014 #52 Apr 23 2023 15:27:51
%S A016014 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,
%T A016014 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,
%U A016014 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
%N A016014 Least k such that 2*n*k + 1 is a prime.
%C A016014 Is the sequence bounded? - _Zak Seidov_, Mar 25 2014
%C A016014 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
%C A016014 a(n) = 1 for n in A005097. - _Robert Israel_, Oct 26 2016
%H A016014 Zak Seidov, <a href="/A016014/b016014.txt">Table of n, a(n) for n = 1..10000</a>
%p A016014 f:= proc(n) local k;
%p A016014      for k from 1 do if isprime(2*n*k+1) then return k fi od
%p A016014 end proc:
%p A016014 map(f, [$1..100]); # _Robert Israel_, Oct 26 2016
%t A016014 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 *)
%t A016014 lk[n_]:=Module[{k=1},While[!PrimeQ[2n k+1],k++];k]; Array[lk,100] (* _Harvey P. Dale_, Apr 23 2023 *)
%o A016014 (PARI) a(n)=my(k); while(!isprime(2*n*(k++)+1),);k \\ _Charles R Greathouse IV_, Mar 25 2014
%o A016014 (Python)
%o A016014 from sympy import isprime
%o A016014 def a(n):
%o A016014     k = 1
%o A016014     while not isprime(2*n*k + 1): k += 1
%o A016014     return k
%o A016014 print([a(n) for n in range(1, 100)]) # _Michael S. Branicky_, Mar 28 2022
%Y A016014 Cf. A005097, A103961.
%Y A016014 A070846 contains the corresponding primes.
%Y A016014 Records are in A239746 with indices in A239727.
%K A016014 nonn
%O A016014 1,4
%A A016014 _Robert G. Wilson v_