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).

Original entry on oeis.org

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
Offset: 1

Views

Author

Paolo P. Lava, Sep 03 2012

Keywords

Examples

			3827 is not prime but 38273, 38237, 38327 and 33827 are all primes.
		

Crossrefs

Programs

  • 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
  • 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 *)