login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A216166 Composite numbers and 1 which yield a prime whenever a 3 is inserted anywhere in them (including at the beginning or end). 3
1, 121, 343, 361, 533, 637, 793, 889, 943, 1183, 3013, 3223, 3353, 3403, 3757, 3827, 3893, 4313, 4543, 4963, 8653, 10423, 14257, 20339, 23083, 23419, 30917, 33031, 33101, 33323, 33433, 33701, 33821, 34333, 34393, 35453, 36437, 36533, 39137, 39247, 42869, 43337 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
EXAMPLE
3827 is not prime but 38273, 38237, 38327 and 33827 are all primes.
MAPLE
with(numtheory);
A216166:=proc(q, x)
local a, b, c, i, n, ok;
for n from 1 to q do
if not isprime(n) then
a:=n; b:=0; while a>0 do b:=b+1; a:=trunc(a/10); od; a:=n; ok:=1;
for i from 0 to b do c:=a+9*10^i*trunc(a/10^i)+10^i*x;
if not isprime(c) then ok:=0; break; fi;
od;
if ok=1 then print(n); fi;
fi;
od; end:
A216166(1000, 3);
MATHEMATICA
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 *)
PROG
(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
CROSSREFS
Sequence in context: A112075 A068872 A203856 * A208242 A167721 A330670
KEYWORD
nonn,base
AUTHOR
Paolo P. Lava, Sep 03 2012
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 20 17:48 EDT 2024. Contains 374459 sequences. (Running on oeis4.)