login
Smallest k such that prime(k*n)-k*prime(n) is prime.
1

%I #13 Jul 04 2021 07:50:20

%S 7,4,2,2,2,2,6,6,4,2,2,6,2,8,2,20,4,2,2,2,6,6,8,6,6,2,4,12,2,8,6,8,2,

%T 2,6,4,2,4,6,26,24,2,2,2,4,8,18,4,2,2,4,12,4,4,18,8,6,16,4,2,2,2,4,2,

%U 2,2,4,18,6,6,4,2,4,4,6,18,2,6,2,18,4,24,6,2,6,6,18,40,2,4,2,2,18,8,34,2,2

%N Smallest k such that prime(k*n)-k*prime(n) is prime.

%H Harvey P. Dale, <a href="/A071185/b071185.txt">Table of n, a(n) for n = 1..1000</a>

%t ppn[n_]:=Module[{k=1,prn=Prime[n]},While[!PrimeQ[Prime[k n]-k prn], k++];k]; Array[ppn,100] (* _Harvey P. Dale_, May 22 2012 *)

%o (PARI) for(n=1,210,s=1; while(isprime(prime(s*n)-s*prime(n))==0,s++); print1(s,","))

%o (Python)

%o from sympy import isprime, prime

%o def a(n):

%o pn = prime(n); k = 1

%o while not isprime(prime(k*n) - k*pn): k += 1

%o return k

%o print([a(n) for n in range(1, 98)]) # _Michael S. Branicky_, Jul 04 2021

%K easy,nonn

%O 1,1

%A _Benoit Cloitre_, Jun 10 2002