login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Smallest k such that k*2*p(n)^2-1 is prime.
9

%I #27 Sep 08 2022 08:46:04

%S 1,1,3,1,1,1,1,4,4,6,4,6,1,1,9,10,1,6,4,7,1,4,3,4,3,10,4,4,1,1,1,10,1,

%T 7,6,12,1,9,6,3,1,1,6,3,1,1,1,3,3,4,4,21,4,1,3,1,6,4,1,10,3,1,15,1,3,

%U 4,9,13,10,9,1,4,1,3,1,3,12,9,6,1,1,22,4,1

%N Smallest k such that k*2*p(n)^2-1 is prime.

%H Pierre CAMI, <a href="/A224489/b224489.txt">Table of n, a(n) for n = 1..10000</a>

%e 1*2*2^2-1=7 is prime, p(1)=2 so a(1)=1.

%e 1*2*3^2-1=17 is prime, p(2)=3 so a(2)=1.

%e 1*2*5^2-1=49 is composite; 2*2*5^2-1=99 is composite; 3*2*5^2-1=149 is prime, p(3)=5 so a(3)=3.

%t a[n_] := For[k = 1, True, k++, If[ PrimeQ[k*2*Prime[n]^2 - 1], Return[k]]]; Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Apr 10 2013 *)

%o PFGW and SCRIPTIFY

%o SCRIPT

%o DIM k

%o DIM i,0

%o DIM q

%o DIMS t

%o OPENFILEOUT myf,a(n).txt

%o LABEL a

%o SET i,i+1

%o IF i>50000 THEN END

%o SET k,0

%o LABEL b

%o SET k,k+1

%o SETS t,%d,%d,%d\,;k;i;p(i)

%o SET q,k*2*p(i)^2-1

%o PRP q,t

%o IF ISPRP THEN WRITE myf,t

%o IF ISPRP THEN GOTO a

%o GOTO b

%o (Magma)

%o S:=[];

%o k:=1;

%o for n in [1..90] do

%o while not IsPrime(k*2*NthPrime(n)^2-1) do

%o k:=k+1;

%o end while;

%o Append(~S, k);

%o k:=1;

%o end for;

%o S; // _Bruno Berselli_, Apr 18 2013

%Y Cf. A224490, A224491, A224492.

%K nonn

%O 1,3

%A _Pierre CAMI_, Apr 08 2013