%I #5 Dec 05 2013 20:16:11
%S 19,11919199,11919991,19111999,19199119,19911919,19991911,91919911,
%T 91999111,99111919,99119191,99919111,1111919999,1111999199,1191911999,
%U 1191919991,1191991991,1191999119,1199911919,1199911991,1199919191
%N Primes consisting only of digits 1 and 9 occurring with equal frequency.
%C There are 18 digit pairs which can produce such primes. (1,0),(7,0),(1,3),(1,4),(1,6),(1,7),(1,9),(2,3),(2,9),(3,4),(3,5),(3,7),(3,8),(4,7),(4,9),(5,9),(6,7),(7,9).
%p Primes consisting only of digits x and y, occurring with equal frequency. d1=x; d2=y; k=0; a=vector(100); for(n=1,3000,B=binary(n); L=length(B); s=sum(j=1,length(B),B[j]); if(L%2==0 & s==L/2,C=vector(L,n,(d2-d1)*B[n]+d1); p=subst(Pol(C),x,10); if(isprime(p),if(k<100,k++; a[k]=p)); D=vector(L,n,d2-(d2-d1)*B[n]); q=subst(Pol(D),x,10); if(isprime(q ),if(k<100,k++; a[k]=q))); ); a=vector(k,n,a[n]); vecsort(a)
%Y Cf. A087510, A087513, A087514.
%K base,nonn
%O 0,1
%A _Amarnath Murthy_ and _Paul D. Hanna_, Sep 11 2003
|