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.

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

This page as a plain text file.
%I A085063 #14 May 15 2018 06:42:15
%S A085063 1,1,2,1,2,1,4,5,2,1,2,1,4,3,2,1,6,1,10,3,2,1,6,13,4,3,4,1,2,1,10,11,
%T A085063 10,3,2,1,4,5,2,1,2,1,4,9,14,1,6,5,4,3,2,1,14,5,6,5,4,1,12,1,6,5,10,3,
%U A085063 2,1,4,15,2,1,8,1,6,27,8,3,6,1,4,3,2,1,6,5,12,11,20,1,12,7,6,5,4,3,2,1,4,5
%N A085063 a(n) is the minimal number k such that n+k and n*k+1 are primes.
%C A085063 If n+1 is prime then a(n)=1; if n+1 is not prime then a(n)=A120223(n).
%H A085063 Robert Israel, <a href="/A085063/b085063.txt">Table of n, a(n) for n = 1..10000</a>
%e A085063 a(3)=2 because 3+2=5 and 3*2+1=7 are prime;
%e A085063 a(8)=5 because 8+5=13 and 8*5+1=41 are prime,
%p A085063 f:= proc(n) local k;
%p A085063 for k from 1+(n mod 2) by 2 do
%p A085063   if isprime(n+k) and isprime(n*k+1) then return k fi
%p A085063 od
%p A085063 end proc:
%p A085063 f(1):= 1: # _Robert Israel_, May 14 2018
%t A085063 Reap[Do[Do[If[PrimeQ[{n+x, n*x+1}]=={True,True},Sow[x];Break[]],{x,1,100}],{n,120}]][[2,1]]
%t A085063 nkp[n_]:=Module[{k=1},While[!And@@PrimeQ[{n+k,n*k+1}],k++];k]; Array[nkp, 100] (* _Harvey P. Dale_, Apr 11 2012 *)
%o A085063 (PARI) a(n) = {my(k=1); while (!isprime(n+k) || !isprime(n*k+1), k++); k;} \\ _Michel Marcus_, May 14 2018
%Y A085063 Cf. A092945, A120223, A120224, A120225.
%K A085063 nonn
%O A085063 1,3
%A A085063 _Amarnath Murthy_, Jun 28 2003
%E A085063 Corrected and extended by _Zak Seidov_, Jun 10 2006