login
Lesser of Gridgeman pairs in base 8 in increasing order: pairs of primes palindromic in base 8 which differ only in their middle digits by a difference of 1.
3

%I #11 Apr 03 2023 10:36:13

%S 2,89,479,12547,14563,15667,28807,30367,31663,32119,296969,311561,

%T 318281,328721,383321,409889,422369,452009,490481,511289,792131,

%U 936227,951851,1345037,1366349,1444901,1505261,1543229,1852679,1861511,1865159,1871951,1898447

%N Lesser of Gridgeman pairs in base 8 in increasing order: pairs of primes palindromic in base 8 which differ only in their middle digits by a difference of 1.

%H Chai Wah Wu, <a href="/A246871/b246871.txt">Table of n, a(n) for n = 1..1000</a>

%H Prime Curios!, <a href="https://t5k.org/curios/cpage/8733.html">181</a>

%e 12547 and 12611 are 2 primes with base 8 representation 30403 and 30503 respectively.

%o (Python)

%o from gmpy2 import digits

%o from sympy import isprime

%o A246871 = [2]

%o for n in range(1,8**5):

%o ....s1 = digits(n,8)

%o ....s2 = s1[::-1]

%o ....for m in range(7):

%o ........p1, p2 = int(s1+str(m)+s2,8), int(s1+str(m+1)+s2,8)

%o ........if isprime(p1) and isprime(p2):

%o ............A246871.append(p1)

%o A246871 = sorted(A246871)

%Y Cf. A246488, A246870, A246872.

%K nonn,base

%O 1,1

%A _Chai Wah Wu_, Sep 06 2014