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.

A216166 Composite numbers and 1 which yield a prime whenever a 3 is inserted anywhere in them (including at the beginning or end).

This page as a plain text file.
%I A216166 #15 Sep 08 2022 08:46:03
%S A216166 1,121,343,361,533,637,793,889,943,1183,3013,3223,3353,3403,3757,3827,
%T A216166 3893,4313,4543,4963,8653,10423,14257,20339,23083,23419,30917,33031,
%U A216166 33101,33323,33433,33701,33821,34333,34393,35453,36437,36533,39137,39247,42869,43337
%N A216166 Composite numbers and 1 which yield a prime whenever a 3 is inserted anywhere in them (including at the beginning or end).
%H A216166 Paolo P. Lava, <a href="/A216166/b216166.txt">Table of n, a(n) for n = 1..150</a>
%e A216166 3827 is not prime but 38273, 38237, 38327 and 33827 are all primes.
%p A216166 with(numtheory);
%p A216166 A216166:=proc(q,x)
%p A216166 local a,b,c,i,n,ok;
%p A216166 for n from 1 to q do
%p A216166 if not isprime(n) then
%p A216166   a:=n; b:=0; while a>0 do b:=b+1; a:=trunc(a/10); od; a:=n; ok:=1;
%p A216166   for i from 0 to b do c:=a+9*10^i*trunc(a/10^i)+10^i*x;
%p A216166     if not isprime(c) then ok:=0; break; fi;
%p A216166   od;
%p A216166   if ok=1 then print(n); fi;
%p A216166 fi;
%p A216166 od; end:
%p A216166 A216166(1000,3);
%t A216166 ap3Q[n_]:=CompositeQ[n]&&AllTrue[FromDigits/@Table[Insert[ IntegerDigits[ n],3,k],{k,IntegerLength[n]+1}],PrimeQ]; Join[{1},Select[Range[ 44000], ap3Q]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Mar 25 2020 *)
%o A216166 (Magma) [n: n in [1..50000] | not IsPrime(n) and forall{m: t in [0..#Intseq(n)] | IsPrime(m) where m is (Floor(n/10^t)*10+3)*10^t+n mod 10^t}]; // _Bruno Berselli_, Sep 03 2012
%Y A216166 Cf. A068673, A068674, A068677, A068679, A069246, A215417, A215419-A215421, A216165, A216167-A216169.
%K A216166 nonn,base
%O A216166 1,2
%A A216166 _Paolo P. Lava_, Sep 03 2012