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.

A375261 Smallest n-digit reversible prime with only prime digits.

This page as a plain text file.
%I A375261 #23 May 12 2025 14:38:01
%S A375261 2,37,337,3257,32233,322573,3222223,32235223,322222223,3222222257,
%T A375261 32222232577,322222232537,3222222223333,32222222332733,
%U A375261 322222222237537,3222222222223373,32222222222223353,322222222222225333,3222222222222222577,32222222222222225573,322222222222222233253
%N A375261 Smallest n-digit reversible prime with only prime digits.
%C A375261 Differs from A177513(n) for n in A082705. - _Robert Israel_, May 11 2025
%H A375261 Robert Israel, <a href="/A375261/b375261.txt">Table of n, a(n) for n = 1..243</a>
%F A375261 a(n) <= A177513(n) for n > 1.
%F A375261 If a(n) is not a palindrome, a(n) = A177513(n) for n > 1.
%p A375261 PD:= [2,3,5,7]:
%p A375261 g:= proc(n) local L,d,i,x,y;
%p A375261   L:= convert(n,base,4); d:= nops(L);
%p A375261   x:= add(PD[L[i]+1]*10^(i-1),i=1..d);
%p A375261   y:= add(PD[L[-i]+1]*10^(i-1),i=1..d);
%p A375261   if isprime(x) and isprime(y) then return x fi;
%p A375261 end proc:
%p A375261 f:= proc(d) local k,v;
%p A375261   for k from 4^(d-1) do v:= g(k); if v <> NULL then return v fi od
%p A375261 end proc;
%p A375261 f(1):= 2:
%p A375261 map(f, [$1..30]); # _Robert Israel_, May 11 2025
%o A375261 (Python)
%o A375261 from sympy import isprime
%o A375261 from itertools import product
%o A375261 def a(n):
%o A375261     if n == 1: return 2
%o A375261     for first in "37":
%o A375261         for rest in product("2357", repeat=n-1):
%o A375261             s = first + "".join(rest)
%o A375261             if isprime(t:=int(s)) and isprime(int(s[::-1])):
%o A375261                 return t
%o A375261 print([a(n) for n in range(1, 22)]) # _Michael S. Branicky_, Aug 08 2024
%Y A375261 Cf. A006567, A082705, A160748, A177513.
%K A375261 base,nonn
%O A375261 1,1
%A A375261 _Jean-Marc Rebert_, Aug 08 2024