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.
%I A046477 #37 May 25 2023 13:25:36 %S A046477 2,3,5,7,373,13331,30103,1496941,1970791 %N A046477 Primes that are palindromic in bases 8 and 10. %C A046477 Any other terms have more than 20 digits. - _Michael S. Branicky_, Dec 19 2020 %H A046477 Patrick De Geest, <a href="http://www.worldofnumbers.com/palpri.htm">World!Of Palindromic Primes</a> %e A046477 373_10 = 565_8. - _Jon E. Schoenfield_, Apr 10 2021 %t A046477 Do[s = RealDigits[n, 8][[1]]; t = RealDigits[n, 10][[1]]; If[PrimeQ[n], If[FromDigits[t] == FromDigits[Reverse[t]], If[FromDigits[s] == FromDigits[Reverse[s]], Print[n]]]], {n, 1, 10^5}] %t A046477 pal810Q[p_]:=PalindromeQ[p]&&IntegerDigits[p,8]==Reverse[IntegerDigits[p,8]]; Select[ Prime[ Range[150000]],pal810Q] (* _Harvey P. Dale_, May 25 2023 *) %o A046477 (Python) # efficiently search to large numbers %o A046477 from sympy import isprime %o A046477 from itertools import product %o A046477 def candidate_prime_pals(digits): %o A046477 ruled_out = "024568" # can't be even or multiple of 5 %o A046477 midrange = [[""], "0123456789"] %o A046477 for p in product("0123456789", repeat=digits//2): %o A046477 left = "".join(p) %o A046477 if len(left): %o A046477 if left[0] in ruled_out: continue %o A046477 for middle in midrange[digits%2]: %o A046477 yield left+middle+left[::-1] %o A046477 for digits in range(1, 15): %o A046477 for p in candidate_prime_pals(digits): %o A046477 intp = int(p); octp = oct(intp)[2:] %o A046477 if octp==octp[::-1]: %o A046477 if isprime(intp): %o A046477 print(intp, end=", ") # _Michael S. Branicky_, Dec 19 2020 %o A046477 (Python) # alternate sufficient for producing terms through a(9) %o A046477 from sympy import isprime %o A046477 def ispal(n): strn = str(n); return strn==strn[::-1] %o A046477 for n in range(10**7): %o A046477 if ispal(n) and ispal(oct(n)[2:]) and isprime(n): %o A046477 print(n) # _Michael S. Branicky_, Dec 20 2020 %o A046477 (PARI) is(n) = my(d=digits(n, 8), dd=digits(n)); d==Vecrev(d) && dd==Vecrev(dd) %o A046477 forprime(p=1, , if(is(p), print1(p, ", "))) \\ _Felix Fröhlich_, Dec 20 2020 %Y A046477 Cf. A002113, A002385, A029976, A029804. %K A046477 nonn,hard,base,more %O A046477 1,1 %A A046477 _Patrick De Geest_, Aug 15 1998