%I #18 Aug 22 2023 08:02:07
%S 5,31,131,151,631,3251,3881,19531,78781,78901,81281,81401,81901,82031,
%T 94531,97001,97501,390781,394501,406381,469501,471901,472631,484531,
%U 1953901,1956881,1968751,1969531,1971901,2031251,2035151,2046901,2047651,2050031,2347001,2360131
%N Primes whose base-5 representation also is the base-2 representation of a prime.
%C This sequence is part of the two-dimensional array of sequences based on this same idea for any two different bases b, c > 1. Sequence A235265 and A235266 are the most elementary ones in this list. Sequences A089971, A089981 and A090707 through A090721, and sequences A065720 - A065727, follow the same idea with one base equal to 10.
%C For further motivation and cross-references, see sequence A235265 which is he main entry for this whole family of sequences.
%C When the smaller base is b=2 such that only digits 0 and 1 are allowed, these are primes that are the sum of distinct powers of the larger base, here c=5, thus a subsequence of A077719.
%H Alois P. Heinz, <a href="/A235462/b235462.txt">Table of n, a(n) for n = 1..10000</a>
%H M. F. Hasler, <a href="https://docs.google.com/document/d/10IM7fcAbB2tqRGuwfGvuEGUzD_IXbgXPDK0tfxN4M3o/pub">Primes whose base c expansion is also the base b expansion of a prime</a>
%e 5 = 10_5 and 10_2 = 2 are both prime, so 5 is a term.
%e 31 = 111_5 and 111_2 = 7 are both prime, so 31 is a term.
%t b5b2Q[n_]:=Module[{idn5=IntegerDigits[n,5]},Max[idn5]<2 && PrimeQ[ FromDigits[ idn5,2]]]; Select[Prime[Range[180000]],b5b2Q] (* _Harvey P. Dale_, Sep 21 2018 *)
%o (PARI) is(p,b=2,c=5)=vecmax(d=digits(p,c))<b&&isprime(vector(#d,i,b^(#d-i))*d~)&&isprime(p)
%o (Python)
%o from itertools import islice
%o from sympy import isprime, nextprime
%o def A235462_gen(): # generator of terms
%o p = 1
%o while (p:=nextprime(p)):
%o if isprime(m:=int(bin(p)[2:],5)):
%o yield m
%o A235462_list = list(islice(A235462_gen(),20)) # _Chai Wah Wu_, Aug 21 2023
%K nonn,base
%O 1,1
%A _M. F. Hasler_, Jan 11 2014