A270361 Odd primes p for which there exists an odd prime q < p such that p*q - 1 is a square.
13, 29, 53, 61, 73, 89, 97, 109, 137, 149, 157, 173, 233, 241, 277, 317, 349, 353, 373, 389, 397, 409, 433, 461, 521, 541, 569, 593, 617, 641, 653, 661, 673, 701, 709, 733, 757, 769, 773, 821, 829, 853, 877, 881, 929, 937
Offset: 1
Keywords
Examples
13 is in this sequence because 13*5 - 1 = 64, which is square, with 5 < 13.
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..10471
Crossrefs
Cf. A002144.
Programs
-
Mathematica
result = {}; Do[p = Prime[i]; Do[q = Prime[j]; r = p*q - 1; If[Mod[r, 8] == 1 || Mod[r, 8] == 0 || Mod[r, 8] == 4, If[IntegerQ[Sqrt[r]], AppendTo[result, p]]], {j, 2, i - 1}], {i, 3, 1000}]; result
-
PARI
lista(nn) = {forprime(p=3, nn, ok = 0; forprime (q=3, p-1, if (issquare(p*q-1), ok = 1; break);); if (ok, print1(p, ", ")););} \\ Michel Marcus, Apr 06 2016
-
Python
from gmpy2 import is_prime, is_square for p in range(3, 10 ** 4, 2): flag = 0 if is_prime(p): for q in range(3, p, 2): if is_square(p * q - 1) and is_prime(q): flag = 1 break if flag: print(p, end=", ") # Soumil Mandal, Apr 07 2016
Comments