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.

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

This page as a plain text file.
%I A224489 #27 Sep 08 2022 08:46:04
%S A224489 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 A224489 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 A224489 4,9,13,10,9,1,4,1,3,1,3,12,9,6,1,1,22,4,1
%N A224489 Smallest k such that k*2*p(n)^2-1 is prime.
%H A224489 Pierre CAMI, <a href="/A224489/b224489.txt">Table of n, a(n) for n = 1..10000</a>
%e A224489 1*2*2^2-1=7 is prime, p(1)=2 so a(1)=1.
%e A224489 1*2*3^2-1=17 is prime, p(2)=3 so a(2)=1.
%e A224489 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 A224489 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 A224489 PFGW and SCRIPTIFY
%o A224489 SCRIPT
%o A224489 DIM k
%o A224489 DIM i,0
%o A224489 DIM q
%o A224489 DIMS t
%o A224489 OPENFILEOUT myf,a(n).txt
%o A224489 LABEL a
%o A224489 SET i,i+1
%o A224489 IF i>50000 THEN END
%o A224489 SET k,0
%o A224489 LABEL b
%o A224489 SET k,k+1
%o A224489 SETS t,%d,%d,%d\,;k;i;p(i)
%o A224489 SET q,k*2*p(i)^2-1
%o A224489 PRP q,t
%o A224489 IF ISPRP THEN WRITE myf,t
%o A224489 IF ISPRP THEN GOTO a
%o A224489 GOTO b
%o A224489 (Magma)
%o A224489 S:=[];
%o A224489 k:=1;
%o A224489 for n in [1..90] do
%o A224489   while not IsPrime(k*2*NthPrime(n)^2-1) do
%o A224489        k:=k+1;
%o A224489   end while;
%o A224489   Append(~S, k);
%o A224489   k:=1;
%o A224489 end for;
%o A224489 S; // _Bruno Berselli_, Apr 18 2013
%Y A224489 Cf. A224490, A224491, A224492.
%K A224489 nonn
%O A224489 1,3
%A A224489 _Pierre CAMI_, Apr 08 2013