%I #23 Feb 16 2020 20:11:28
%S 133,303,323,334,335,339,393,533,633,933,1333,3133,3233,3334,3337,
%T 3338,3353,3383,4333,6333,8333,13333,30333,33133,33233,33313,33323,
%U 33339,33373,33393,33433,33833,33933,35333,37333,43333,73333,83333,133333
%N Near-repdigit semiprimes with 3 as repeated digit.
%H Charles R Greathouse IV, <a href="/A105984/b105984.txt">Table of n, a(n) for n = 1..1962</a>
%e a(2)=303 is a term because 303 is a semiprime and all digits are equal to 3 except one.
%t okQ[n_]:=DigitCount[n,10,3]==IntegerLength[n]-1&&n>99; upto=150000; p=Prime[Range[PrimePi[upto/2]]]; lim= Floor[Sqrt[upto]]; sp={};k=0;While[k++;p[[k]]<=lim, sp=Join[sp,p[[k]]*Take[p,{k,PrimePi[upto/p[[k]]]}]]]; sp=Sort[sp]; Select[sp,okQ] (* _Harvey P. Dale_, Mar 18 2011; semiprime generating portion from A001358, Mar 15 2011 *)
%t s={};Do[t3=Table[3,{k}];Do[If[d ≠ 3,rep=FromDigits/@Permutations[Flatten@{t3,d}]; s=Join[s,Select[rep,2==Plus@@Last/@FactorInteger[#]&]]],{d,0,9}],{k,2,13}];Rest@Union@s (* _Zak Seidov_, Mar 18 2011 *)
%o (PARI) issemi(n)={ \\ Much faster tests are possible, this is a basic one
%o forprime(p=2,min(1e5,n^(1/3)),
%o if (n%p == 0, return (isprime(n\p)))
%o );
%o if (isprime(n), return(0));
%o if (n < 1e15, return(1));
%o my(f = factorint(n,9));
%o if (#f[,1] > 2, return(0));
%o if (#f[,1] == 2,
%o if (f[1,2] + f[2,2] > 2, return(0));
%o return (isprime(f[1,1]) && isprime(f[2,1]))
%o );
%o bigomega(n) == 2
%o };
%o v=List();for(l=3,30,N=10^l\3;forstep(i=l-1,0,-1,t=10^i;forstep(a=-3*t,6*t,[t,t,2*t,t,t,t,t,t],if(issemi(N+a)&N+a>33,listput(v,N+a))))); v=Vec(v)
%o \\ _Charles R Greathouse IV_, Mar 18 2011
%K base,nonn
%O 1,1
%A _Shyam Sunder Gupta_, Apr 29 2005