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.

Showing 1-6 of 6 results.

A157676 Numbers n such that n + (product of digits of n) is prime.

Original entry on oeis.org

1, 21, 23, 27, 29, 61, 67, 81, 83, 101, 103, 107, 109, 161, 163, 169, 233, 239, 253, 259, 283, 289, 293, 299, 307, 329, 341, 343, 347, 349, 361, 401, 409, 431, 437, 439, 441, 443, 449, 471, 473, 477, 493, 499, 503, 509, 529, 563, 569, 601, 607, 611, 613, 617
Offset: 1

Views

Author

Kyle D. Balliet, Mar 04 2009

Keywords

Examples

			a(21) = 21 + (2)(1) = 23 (prime). a(67) = 67 + (6)(7) = 109 (prime). a(169) = 169 + (1)(6)(9) = 223 (prime).
		

Crossrefs

Programs

  • Mathematica
    fQ[n_] := PrimeQ[n + Times @@ IntegerDigits@n]; Select[ Range@1000, fQ@# &] (* Robert G. Wilson v, May 04 2009 *)
  • PARI
    dprod(n)=n=digits(n);prod(i=1,#n,n[i])
    is(n)=isprime(dprod(n)+n) \\ Charles R Greathouse IV, Dec 27 2013

Formula

a(n) ~ n log n. - Charles R Greathouse IV, Dec 27 2013

Extensions

More terms from Robert G. Wilson v, May 04 2009

A225303 Primes of the form p + (product of digits of p), where p is a prime.

Original entry on oeis.org

29, 47, 67, 101, 103, 107, 109, 181, 251, 293, 307, 331, 347, 401, 409, 431, 443, 457, 491, 503, 509, 547, 593, 601, 607, 631, 653, 659, 673, 701, 709, 743, 809, 823, 827, 839, 907, 929, 971, 977, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091
Offset: 1

Views

Author

Jayanta Basu, May 05 2013

Keywords

Comments

Primes generated by A157677.

Examples

			29 is in the list since 29 = 23 + (2*3).
		

Crossrefs

Cf. A157677.

Programs

  • Maple
    f:= proc(n) local L,v;
      if not isprime(n) then return NULL fi;
      L:= convert(n,base,10);
      if member(0,L) then return n fi;
      v:= n + convert(L,`*`);
      if isprime(v) then v else NULL fi
    end proc:
    N:= 2000: # to get all terms <= N
    S:= {}:
    for n from 3 by 2 to N do
      v:= f(n);
      if v <> NULL and v <= N then S:= S union {v} fi;
    od:
    sort(convert(S,list));# Robert Israel, Jun 25 2019
  • Mathematica
    Sort[DeleteDuplicates[Select[Table[p=Prime[n]; p+Times@@IntegerDigits[p], {n,175}],PrimeQ]]]
    Select[Table[p+Times@@IntegerDigits[p],{p,Prime[Range[ 200]]}], PrimeQ]// Union (* Harvey P. Dale, Sep 21 2019 *)

Extensions

1049,1051,1061,1063,1069 and 1087 inserted by Robert Israel, Jun 25 2019

A225319 Prime numbers p such that p - (product of digits of p) is also prime.

Original entry on oeis.org

23, 29, 41, 43, 47, 83, 89, 101, 103, 107, 109, 127, 149, 181, 223, 227, 229, 241, 251, 263, 271, 277, 293, 307, 347, 349, 367, 383, 389, 401, 409, 419, 431, 433, 439, 457, 479, 487, 503, 509, 541, 587, 601, 607, 631, 641, 643, 647, 653, 659, 673, 677, 701
Offset: 1

Views

Author

Jayanta Basu, May 05 2013

Keywords

Examples

			29 is in the list since 29 - (2*9) = 11 is a prime.
		

Crossrefs

Cf. A157677.

Programs

  • Mathematica
    Select[Prime[Range[126]], PrimeQ[#-Times@@IntegerDigits[#]] &]

A227217 Primes p such that p + (product of digits of p) is prime and p - (product of digits of p) is prime.

Original entry on oeis.org

23, 29, 83, 101, 103, 107, 109, 293, 307, 347, 349, 401, 409, 431, 439, 503, 509, 601, 607, 653, 659, 677, 701, 709, 743, 809, 907, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1123, 1201, 1297, 1301, 1303, 1307, 1409, 1423, 1489, 1523
Offset: 1

Views

Author

Derek Orr, Sep 19 2013

Keywords

Comments

Intersection of A157677 and A225319.
Contains A056709. - Robert Israel, Apr 13 2015

Examples

			431 is prime, 431 + (4*3*1) = 443 is prime, and 431 - (4*3*1) = 419 is prime. So, 431 is a term in the sequence.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local m;
      if not isprime(n) then return false fi;
      m:= convert(convert(n,base,10),`*`);
      if m = 0 then return true fi;
      isprime(n+m) and isprime(n-m)
    end proc:
    select(filter, [seq(2*i+1,i=5..10000)]); # Robert Israel, Apr 13 2015
  • Mathematica
    fQ[n_] := Block[{d = IntegerDigits@ n}, PrimeQ[n + Times @@ d] && PrimeQ[n - Times @@ d]]; Select[Prime@ Range@ 250, fQ] (* Michael De Vlieger, Apr 12 2015 *)
  • PARI
    forprime(p=1,2000,d=digits(p);P=prod(i=1,#d,d[i]);if(isprime(p+P)&&isprime(p-P),print1(p,", "))) \\ Derek Orr, Apr 10 2015
  • Python
    from sympy import isprime, primerange
    def DP(n):
        p = 1
        for i in str(n):
            p *= int(i)
        return p
    for pn in primerange(1, 2000):
        dpn = DP(pn)
        if isprime(pn-dpn) and isprime(pn+dpn):
            print(pn, end=', ')
    # Simplified by Derek Orr, Apr 10 2015
    
  • Sage
    [p for p in primes_first_n(1000) if ((p-prod(Integer(p).digits(base=10))) in Primes() and (p+prod(Integer(p).digits(base=10))) in Primes())] # Tom Edgar, Sep 19 2013
    

Extensions

More terms from Derek Orr, Apr 10 2015

A229176 Primes p with nonzero digits such that p + product_of_digits and p - product_of_digits are both prime.

Original entry on oeis.org

23, 29, 83, 293, 347, 349, 431, 439, 653, 659, 677, 743, 1123, 1297, 1423, 1489, 1523, 1657, 1867, 2239, 2377, 2459, 2467, 2543, 2579, 2663, 2753, 3163, 3253, 3271, 3329, 3457, 3461, 3581, 3691, 3727, 3833, 3947, 3967, 4129, 4253, 4297, 4423, 4567, 4957, 5323, 5381, 5651
Offset: 1

Views

Author

Derek Orr, Sep 30 2013

Keywords

Comments

Numbers with nonzero digits in A227217; the non-degenerate cases, so to speak.
Intersection of primes with nonzero digits in A157677 and A225319.

Examples

			743 is prime.
743 - (7*4*3) = 659 is prime.
743 + (7*4*3) = 827 is prime.
So, 743 is a member of this sequence.
		

Crossrefs

Programs

  • Maple
    A007954 := proc(n)
        mul(d, d=convert(n, base, 10))
    end proc:
    isA229176 := proc(n)
        if isprime(n) and A007954(n) <> 0 then
            isprime(n+A007954(n)) and isprime(n-A007954(n))  ;
            simplify(%) ;
        else
            false;
        end if;
    end proc:
    for n from 1 to 10000 do
        if isA229176(n) then
            printf("%d,",n) ;
        end if;
    end do:
  • Mathematica
    id[x_] := IntegerDigits[x]; ti[x_] := Times @@ id[x]; m=5000; Select[Range[3,m,2], PrimeQ[#] && Min[id[#]] > 0 && PrimeQ[#+ti[#]] && PrimeQ[#-ti[#]]&] (* Zak Seidov, Oct 02 2013 *)
    t@n_ := Block[{p = Times @@ IntegerDigits@n},
      If[p == 0, {0}, n + {-p, p}]]; Select[Prime@Range@1000,
    AllTrue[t@#, PrimeQ] &] (* Hans Rudolf Widmer, Dec 13 2021 *)
  • PARI
    forprime(p=1,10^4,d=digits(p);P=prod(i=1,#d,d[i]);if(P&&isprime(p+P)&&isprime(p-P),print1(p,", "))) \\ Derek Orr, Mar 22 2015
  • Python
    import sympy
    from sympy import isprime
    def DP(n):
      p = 1
      for i in str(n):
        p *= int(i)
      return p
    {print(n, end=', ') for n in range(10**4) if DP(n) and isprime(n) and isprime(n+DP(n)) and isprime(n-DP(n))}
    # Simplified by Derek Orr, Mar 22 2015
    

A225677 Primes of the form p - (product of digits of p), where p is a prime.

Original entry on oeis.org

11, 17, 19, 31, 37, 59, 101, 103, 107, 109, 113, 173, 179, 193, 199, 211, 227, 233, 239, 241, 257, 263, 307, 311, 317, 331, 383, 389, 397, 401, 409, 419, 439, 479, 499, 503, 509, 521, 547, 563, 571, 577, 601, 607, 613, 617, 659, 691, 701, 709, 719, 733, 809
Offset: 1

Views

Author

Jayanta Basu, May 12 2013

Keywords

Comments

Primes generated by A225319.

Examples

			17 is in the list since 17 = 23 - (2*3).
		

Crossrefs

Programs

  • Mathematica
    Union[Select[Table[p=Prime[n]; p-Times@@IntegerDigits[p],{n,150}],PrimeQ]]
Showing 1-6 of 6 results.