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.

A174844 Primes that generate three other primes when 2, 6, and 8, respectively, are subtracted from each digit of their decimal representations.

Original entry on oeis.org

9898898899, 889898999999, 889989889889, 898888889989, 989899998889, 999988988989, 988898889999899, 989998888989889, 98888888989989899, 99999998998988999, 888898989989989999, 888998889889898899, 889888889998888999, 889888898999988989, 889988888998998889
Offset: 1

Views

Author

Rick L. Shepherd, Mar 30 2010

Keywords

Comments

Subsequence of A020472. The primes generated from the subtractions are in A020469, A020458, and A020449, respectively. Final digits are necessarily 9 (here), then 7, 3, and 1. Because leading 8's are permitted in the terms here, the primes generated by subtracting 8's may have fewer digits than the others.

Examples

			9898898899 is prime and so are 7676676677, 3232232233, and 1010010011, so it is a term. Although 9349, 9349-2222=7127, 9349-6666=2683, and 9349-8888=461 are four primes, 9349 is not a term as subtracting 6 or 8 from the digits 3 and 4 is not possible (no "borrowing" is permitted).
		

Crossrefs

Programs

  • Maple
    Res:= NULL: count:= 0:
    for d from 2 while count < 100 do
      v:= (10^d-1)/9;
      for m from 1 to d do
        if m mod 3 <> 0 and 2*d+m mod 3 <> 0 then
          for S in combinat:-choose([$1..(d-2)],m-1) do
            q:= 1+add(10^i,i=S);
            if andmap(isprime, [q, 2*v+q, 6*v+q, 8*v+q]) then
               count:= count+1; Res:= Res, 8*v+q;
            fi
          od;
        fi
      od;
    od:
    sort([Res]); # Robert Israel, Nov 14 2022
  • Mathematica
    okQ[n_]:=Module[{idn=IntegerDigits[n]},And@@PrimeQ[FromDigits/@ {idn-2, idn-6, idn-8}]]; Select[Flatten[Table[Select[FromDigits/@ Tuples[ {8,9},n], PrimeQ],{n,18}]],okQ] (* Harvey P. Dale, Jul 27 2011 *)
  • PARI
    {/* Program based on that of M. F. Hasler in A020472. */
    for(nd=1, 20, p=vector(nd, i, 10^(nd-i))~; r=(10^nd-1)/9;
    forvec(v=vector(nd, i, [8+(i==nd), 9]), q=v*p; isprime(q) &&
    isprime(q-2*r ) && isprime(q-6*r ) && isprime(q-8*r ) && print1(q", ")))}
    
  • Python
    from sympy import isprime
    from itertools import count, islice, product
    def agen(): # generator of terms
        for d in count(2):
            subs = list(map(int, ["2"*d, "6"*d, "8"*d]))
            for first in product("89", repeat=d-1):
                t = int("".join(first) + "9")
                if isprime(t) and all(isprime(t-s) for s in subs): yield t
    print(list(islice(agen(), 15))) # Michael S. Branicky, Nov 15 2022