[go: up one dir, main page]

login
A224489
Smallest k such that k*2*p(n)^2-1 is prime.
9
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, 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, 4, 9, 13, 10, 9, 1, 4, 1, 3, 1, 3, 12, 9, 6, 1, 1, 22, 4, 1
OFFSET
1,3
EXAMPLE
1*2*2^2-1=7 is prime, p(1)=2 so a(1)=1.
1*2*3^2-1=17 is prime, p(2)=3 so a(2)=1.
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.
MATHEMATICA
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 *)
PROG
PFGW and SCRIPTIFY
SCRIPT
DIM k
DIM i, 0
DIM q
DIMS t
OPENFILEOUT myf, a(n).txt
LABEL a
SET i, i+1
IF i>50000 THEN END
SET k, 0
LABEL b
SET k, k+1
SETS t, %d, %d, %d\,; k; i; p(i)
SET q, k*2*p(i)^2-1
PRP q, t
IF ISPRP THEN WRITE myf, t
IF ISPRP THEN GOTO a
GOTO b
(Magma)
S:=[];
k:=1;
for n in [1..90] do
while not IsPrime(k*2*NthPrime(n)^2-1) do
k:=k+1;
end while;
Append(~S, k);
k:=1;
end for;
S; // Bruno Berselli, Apr 18 2013
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Apr 08 2013
STATUS
approved