login
Smallest m such that m^k-2 and m^k+2 are prime for k=1..n.
0

%I #29 Nov 29 2022 10:31:45

%S 5,9,102795,559838181,27336417022509

%N Smallest m such that m^k-2 and m^k+2 are prime for k=1..n.

%e a(3) = 102795 because:

%e for k = 1; 102795^1-2 = 102793 and 102795^1+2 = 102797, both of which are prime, and

%e for k = 2; 102795^2-2 = 10566812023 and 102795^2+2 = 10566812027, both of which are prime, and

%e for k = 3; 102795^3-2 = 1086215442109873 and 102795^3+2 = 1086215442109877, both of which are prime, and

%e 102795 is the smallest number with this property.

%o (PARI) isok(m,n) = for (k=1, n, if(!isprime(m^k-2) || !isprime(m^k+2), return(0));); return(1);

%o a(n) = my(m=1); while(!isok(m, n), m++); m; \\ _Michel Marcus_, Nov 14 2022

%Y Cf. A189051, A245510, A245512, A329727.

%K nonn,more,hard

%O 1,1

%A _Kellen Shenton_, Sep 24 2022