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.

A120223 a(n) is the minimal number k>1 such that n+k and n*k+1 are primes.

This page as a plain text file.
%I A120223 #12 Feb 04 2019 03:02:04
%S A120223 2,3,2,3,2,5,4,5,2,3,2,5,4,3,2,7,6,11,10,3,2,9,6,13,4,3,4,15,2,7,10,
%T A120223 11,10,3,2,5,4,5,2,7,2,5,4,9,14,13,6,5,4,3,2,21,14,5,6,5,4,9,12,7,6,5,
%U A120223 10,3,2,5,4,15,2,3,8,25,6,27,8,3,6,11,4,3,2,15,6,5,12,11,20,15,12,7,6,5,4,3
%N A120223 a(n) is the minimal number k>1 such that n+k and n*k+1 are primes.
%C A120223 If n+1 is prime then a(n)>A085063(n); if n+1 is not prime then a(n)=A085063(n).
%H A120223 Robert Israel, <a href="/A120223/b120223.txt">Table of n, a(n) for n = 1..10000</a>
%e A120223 a(3)=2 because 3+2=5 and 3*2+1=7 are prime;
%e A120223 a(8)=5 because 8+5=13 and 8*5+1=41 are prime.
%p A120223 f:= proc(n) local k;
%p A120223   for k from `if`( n::odd,2,3) do
%p A120223      if isprime(n*k+1) and isprime(n+k) then return k fi
%p A120223   od
%p A120223 end proc:
%p A120223 map(f, [$1..100]); # _Robert Israel_, Feb 03 2019
%t A120223 Reap[Do[Do[If[PrimeQ[{n+x, n*x+1}]=={True,True},Sow[x];Break[]],{x,2,100}],{n,120}]][[2,1]]
%t A120223 mnk[n_]:=Module[{k=2},While[!AllTrue[{n+k,n*k+1},PrimeQ],k++];k]; Array[ mnk,100] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Oct 15 2014 *)
%o A120223 (PARI) for(n=1,100,k=2;while(!isprime(n+k),k++;while(!isprime(n*k+1),k++));print1(k,", ")) \\ _Jinyuan Wang_, Feb 04 2019
%Y A120223 Cf. A085063, A092945, A085063, A120224, A120225.
%K A120223 nonn
%O A120223 1,1
%A A120223 _Zak Seidov_, Jun 10 2006