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-10 of 10 results.

A028834 Numbers whose sum of digits is a prime.

Original entry on oeis.org

2, 3, 5, 7, 11, 12, 14, 16, 20, 21, 23, 25, 29, 30, 32, 34, 38, 41, 43, 47, 49, 50, 52, 56, 58, 61, 65, 67, 70, 74, 76, 83, 85, 89, 92, 94, 98, 101, 102, 104, 106, 110, 111, 113, 115, 119, 120, 122, 124, 128, 131, 133, 137, 139, 140, 142, 146, 148, 151, 155, 157, 160, 164, 166, 173, 175, 179, 182
Offset: 1

Views

Author

Armand Turpel (armand(AT)vo.lu, armand_t(AT)geocities.com)

Keywords

Examples

			89 included because 8+9 = 17, which is prime.
		

Crossrefs

Cf. A010051; A046704 is a subsequence.
Complement of A104211.

Programs

  • Haskell
    a028834 n = a028834_list !! (n-1)
    a028834_list = filter ((== 1) . a010051 . a007953) [1..]
    -- Reinhard Zumkeller, Nov 13 2011
    
  • Maple
    a:=proc(n) local nn: nn:=convert(n,base,10): if isprime(sum(nn[j],j=1..nops(nn)))=true then n else fi end: seq(a(n),n=1..200); # Emeric Deutsch, Mar 17 2007
  • Mathematica
    Select[Range[200],PrimeQ[Total[IntegerDigits[#]]]&]  (* Harvey P. Dale, Feb 18 2011 *)
  • PARI
    is(n)=isprime(sumdigits(n)) \\ Felix Fröhlich, Aug 16 2014
    
  • Python
    from sympy import isprime
    def ok(n): return isprime(sum(map(int, str(n))))
    print(list(filter(ok, range(183)))) # Michael S. Branicky, Jun 18 2021
    
  • R
    require(gmp); which(sapply(1:1000, function(i) isprime(sum(floor(i/10^(0:(nchar(i)-1)))%%10)))==2) # Christian N. K. Anderson, Apr 22 2024
  • Sage
    [x for x in range(200) if (sum(Integer(x).digits(base=10))) in Primes()] # Bruno Berselli, May 05 2014
    

Extensions

More terms from Scott Lindhurst (ScottL(AT)alumni.princeton.edu)

A047855 a(n) = A047848(7,n).

Original entry on oeis.org

1, 2, 12, 112, 1112, 11112, 111112, 1111112, 11111112, 111111112, 1111111112, 11111111112, 111111111112, 1111111111112, 11111111111112, 111111111111112, 1111111111111112, 11111111111111112, 111111111111111112, 1111111111111111112, 11111111111111111112, 111111111111111111112
Offset: 0

Views

Author

Keywords

Comments

n-th difference of a(n), a(n-1), ..., a(0) is A001019(n-1) for n >= 1.
Range of A164898, apart from first term. - Reinhard Zumkeller, Aug 30 2009
a(n) is the number of integers less than or equal to 10^n, whose initial digit is 1. - Michel Marcus, Jul 04 2019
a(n) is 2^n represented in bijective base-2 numeration. - Alois P. Heinz, Aug 26 2019
This sequence proves both A028842 (numbers with prime product of digits) and A028843 (numbers with prime iterated product of digits) are infinite. Proof: Suppose either of those sequences is finite. Label as omega the supposed last term. Compute n = ceiling(log_10 omega) + 1. Then a(n) > omega. The product of digits of a(n) is 2, contradicting the assumption that omega is the final term of either A028842 or A028843. - Alonso del Arte, Apr 14 2020
For n >= 2, the concatenation of a(n) with 8*a(n) equals (3*R_n+3)^2, where R_n = A002275(n) is the repunit with n 1's; hence this sequence, except for {1,2}, is a subsequence of A115549. - Bernard Schott, Apr 30 2022

Crossrefs

Programs

  • Magma
    [(10^n + 8)/9: n in [0..40]]; // G. C. Greubel, Jan 11 2025
    
  • Maple
    a[0]:=0:a[1]:=1:for n from 2 to 50 do a[n]:=10*a[n-1]+1 od: seq(a[n]+1, n=0..18); # Zerinvary Lajos, Mar 20 2008
  • Mathematica
    Join[{1}, Table[FromDigits[PadLeft[{2}, n, 1]], {n, 30}]] (* Harvey P. Dale, Apr 17 2013 *)
    (10^Range[0, 29] + 8)/9 (* Alonso del Arte, Apr 12 2020 *)
  • PARI
    a(n)=if(n==0,1,if(n==1,2,11*a(n-1)-10*a(n-2)))
    for(i=0,10,print1(a(i),",")) \\ Lambert Klasen, Jan 28 2005
    
  • Python
    def A047855(n): return (pow(10,n) +8)//9
    print([A047855(n) for n in range(41)]) # G. C. Greubel, Jan 11 2025
  • Sage
    [gaussian_binomial(n,1,10)+1 for n in range(17)] # Zerinvary Lajos, May 29 2009
    
  • Scala
    (List.fill(20)(10: BigInt)).scanLeft(1: BigInt)( * ).map(n => (n + 8)/9) // Alonso del Arte, Apr 12 2020
    

Formula

a(n) = (10^n + 8)/9. - Ralf Stephan, Feb 14 2004
a(0) = 1, a(1) = 2, a(n) = 11*a(n-1) - 10*a(n-2) for n > 1. - Lambert Klasen (lambert.klasen(AT)gmx.net), Jan 28 2005
G.f.: (1 - 9*x)/(1 - 11*x + 10*x^2). - Philippe Deléham, Oct 05 2009
a(n) = 10*a(n-1) - 8 (with a(0) = 1). - Vincenzo Librandi, Aug 06 2010
From Elmo R. Oliveira, Apr 03 2025: (Start)
E.g.f.: exp(x)*(8 + exp(9*x))/9.
a(n) = (A062397(n) - A002281(n))/2. (End)

Extensions

More terms from Harvey P. Dale, Apr 17 2013

A046703 Multiplicative primes: product of digits is a prime.

Original entry on oeis.org

2, 3, 5, 7, 13, 17, 31, 71, 113, 131, 151, 211, 311, 1117, 1151, 1171, 1511, 2111, 11113, 11117, 11131, 11171, 11311, 111121, 111211, 112111, 113111, 131111, 311111, 511111, 1111151, 1111211, 1111711, 1117111, 1171111, 11111117, 11111131, 11111171, 11111311, 11113111, 11131111
Offset: 1

Views

Author

Keywords

Comments

Primes with one prime digit and all other digits are 1. The linked table includes probable primes. - Jens Kruse Andersen, Jul 21 2014

Crossrefs

Cf. A117835 ("noncomposite" variant), A007954 (product of digits), A028842 (product of digits is prime).

Programs

  • Mathematica
    Select[Prime[Range[740000]],PrimeQ[Times@@IntegerDigits[#]]&] (* Harvey P. Dale, Oct 02 2011 *)
    Select[FromDigits/@Flatten[Table[Permutations[PadRight[{p},n,1]],{n,8},{p,{2,3,5,7}}],2],PrimeQ]//Union (* Harvey P. Dale, Nov 21 2019 *)
  • PARI
    f(n,b,d) = if(d, f(10*n+1, b, d-1); if(!b, forprime(q=2, 9, f(10*n+q, 1, d-1))), if(b && isprime(n), print1(n", ")))
    for(d=1, 8, f(0,0,d)) \\ f(0,0,d) prints d-digit terms. Jens Kruse Andersen, Jul 21 2014
    
  • PARI
    \\ From M. F. Hasler, Apr 23 2019: (Start)
    select( is_A046703(n)=isprime(vecprod(digits(n)))&&ispseudoprime(n), [0..9999]) \\ This defines is_A046703(). In older PARI versions, vecprod=factorback.
    next_A046703(n)={if( n>1, until( ispseudoprime(n), my(d=digits(n)); n=fromdigits( apply( t->if(t>1, nextprime(t+1), 1), d))+(d[1]>5)); n, 2)}
    A046703_vec(N=99)=vector(N, i, t=next_A046703(if(i>1, t))) \\ (End)

Extensions

Corrected by Harvey P. Dale, Oct 02 2011

A028843 Numbers whose iterated product of digits is a prime.

Original entry on oeis.org

2, 3, 5, 7, 12, 13, 15, 17, 21, 26, 31, 34, 35, 37, 43, 51, 53, 57, 62, 71, 73, 75, 112, 113, 115, 117, 121, 126, 131, 134, 135, 137, 143, 151, 153, 157, 162, 171, 173, 175, 211, 216, 223, 232, 261, 278, 279, 287, 297, 299, 311, 314, 315, 317, 322, 341, 351, 355
Offset: 1

Views

Author

Keywords

Examples

			For 53, the product of digits is 5 * 3 = 15, iterated to 1 * 5 = 5, which is a prime, so 53 is in the sequence.
For 54, the product of digits is 5 * 4 = 20, iterated to 2 * 0 = 0, which is not prime, so 54 is not in the sequence.
		

Crossrefs

Programs

  • Mathematica
    iterDigitProd[n_] := NestWhile[Times@@IntegerDigits[#] &, n, # > 9 &]; Select[Range[355], PrimeQ[iterDigitProd[#]] &] (* Jayanta Basu, Jun 02 2013 *)
  • Scala
    def iterDigitProd(n: Int): Int = n.toString.length match {
      case 1 => n
      case  => iterDigitProd(n.toString.toCharArray.map( - 48).scanRight(1)( * ).head)
    }
    (1 to 400).filter(n => List(2, 3, 5, 7).contains(iterDigitProd(n))) // Alonso del Arte, Apr 11 2020

Extensions

More terms from Patrick De Geest, Jun 15 1999
Corrected by Franklin T. Adams-Watters, Jan 17 2007

A046713 Multiplicative and additive primes: primes where the product and sum of digits are also prime.

Original entry on oeis.org

2, 3, 5, 7, 113, 131, 151, 311, 2111, 11113, 11117, 11131, 11171, 11311, 111121, 111211, 112111, 1111151, 1111711, 1117111, 1171111, 111111113, 111111131, 111113111, 115111111, 131111111, 1111111121, 1111211111, 1121111111, 11111111113, 11111111131, 11113111111
Offset: 1

Views

Author

Keywords

Comments

Any term of this sequence has one prime digit and all other digits are 1. - Sean A. Irvine, Apr 17 2021

References

  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 113.

Crossrefs

Intersection of A028834, A028842, and A000040.
Intersection of A046703 and A046704.

Programs

  • Mathematica
    d[n_]:=IntegerDigits[n]; t={}; Do[p=Prime[n]; If[PrimeQ[Plus@@(x=d[p])]&&PrimeQ[Times@@x],AppendTo[t,p]],{n,2*10^5}]; t (* Jayanta Basu, May 18 2013 *)
    Select[Prime[Range[5033*10^5]],AllTrue[{Total[IntegerDigits[ #]],Times@@ IntegerDigits[ #]},PrimeQ]&] (* or -- much faster *) Select[Union[ Flatten[ Table[FromDigits/@Permutations[PadRight[{p},n,1]],{p,{2,3,5,7}},{n,11}]]],AllTrue[{#,Total[ IntegerDigits[#]],Times@@ IntegerDigits[ #]},PrimeQ]&] (* Harvey P. Dale, Feb 28 2022 *)

Extensions

More terms from Harvey P. Dale, Aug 23 2000
Corrected by Jud McCranie, Jan 03 2001
Edited by Charles R Greathouse IV, Aug 02 2010

A117835 Prime numbers for which the product of the digits is a noncomposite number.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 31, 71, 113, 131, 151, 211, 311, 1117, 1151, 1171, 1511, 2111, 11113, 11117, 11131, 11171, 11311, 111121, 111211, 112111, 113111, 131111, 311111, 511111, 1111151, 1111211, 1111711, 1117111, 1171111, 11111117, 11111131, 11111171, 11111311, 11113111, 11131111
Offset: 1

Views

Author

Luc Stevens (lms022(AT)yahoo.com), Apr 30 2006

Keywords

Comments

None of the numbers in the sequence can have a digit 0, 4, 6, 8 or 9. The digits are all 1's, or there is one digit 2, 3, 5 or 7 and all the others are 1's.
A variant of A046703 where the "all '1's" (repunit primes R(k) with k in A004023: R(2) = 11, R(19), ...) are excluded. - M. F. Hasler, Apr 22 2019
Contains primes in A028842 as a subset. - M. F. Hasler, Apr 23 2019

Crossrefs

Cf. A046703 ("prime" variant), A007954 (product of digits), A008578 (noncomposite numbers), A028842 (product of digits is prime).

Programs

  • Mathematica
    Select[Prime[Range[10^6]],PrimeQ[Times@@IntegerDigits[#]]||Times@@IntegerDigits[#]==1&] (* James C. McMahon, Sep 24 2024 *)
  • PARI
    select( is_A117835(n)=isprime(n)&&(isprime(n=vecprod(digits(n)))||n==1), [0..999]) \\ In older PARI versions, vecprod=factorback. \\ M. F. Hasler, Apr 23 2019
    
  • PARI
    next_A117835(n)={until( isprime(n), my(d=digits(n)); n=if(n<3||Set(d)==[1], n+1, fromdigits(apply(t->if(t<2, 1, t<7, nextprime(t+1), 11), d))));n}
    A117835_vec(N=99)=vector(N,i,t=next_A117835(if(i>1,t))) \\ M. F. Hasler, Apr 23 2019

Formula

A117835 = { n in A008578 | A007954(n) is again in A008578 }. - M. F. Hasler, Apr 23 2019

Extensions

Name changed, following a remark from Zak Seidov, and edited by M. F. Hasler, Apr 22 2019

A052430 Numbers n such that sum of digits and product of digits are both prime.

Original entry on oeis.org

2, 3, 5, 7, 12, 21, 113, 115, 131, 151, 311, 511, 1112, 1121, 1211, 2111, 11113, 11117, 11131, 11171, 11311, 11711, 13111, 17111, 31111, 71111, 111112, 111121, 111211, 112111, 121111, 211111, 1111115, 1111117, 1111151, 1111171, 1111511, 1111711
Offset: 1

Views

Author

Henry Bottomley, Mar 14 2000

Keywords

Comments

One digit must be 2, 3, 5, or 7 and every other digit must be 1. If k is in the sequence, then so is every permutation of the digits of k. - Sean A. Irvine, Nov 08 2021

Examples

			a(7)=115 because 1+1+5=7 which is prime and 1*1*5=5 which is prime
		

Crossrefs

Programs

  • Mathematica
    okQ[n_]:=Module[{idn=IntegerDigits[n]},PrimeQ[Total[idn]]&&PrimeQ[Times@@idn]]
    Select[Range[1500000],okQ] (* Harvey P. Dale, Dec 15 2010 *)

A046705 Palindromic primes whose product of digits is a prime.

Original entry on oeis.org

2, 3, 5, 7, 131, 151, 11311, 1117111, 111111151111111, 111111111111111111131111111111111111111, 1111111111111111111111111111111117111111111111111111111111111111111, 1111111111111111111111111111111111111111111115111111111111111111111111111111111111111111111
Offset: 1

Views

Author

Keywords

Comments

Except for the first 4 terms, a subsequence of A088281. - Chai Wah Wu, Dec 17 2015
Subsequence of A028842, of A046703, and also of A117058. - Michel Marcus, Dec 18 2015

Crossrefs

Programs

  • Mathematica
    t = Prime[Range[4]]; Union[Select[Flatten[Table[NestList[FromDigits[Flatten[{1, IntegerDigits[#], 1}]] &, n, 45], {n, t}]], PrimeQ]] (* Jayanta Basu, Jun 27 2013 *)
  • Python
    from _future_ import division
    from sympy import isprime
    A046705_list = [n for n in ((10**(2*l+1)-1)//9+d*10**l for l in range(100) for d in [1,2,4,6]) if isprime(n)] # Chai Wah Wu, Dec 17 2015

A334534 Numbers k such that (k-p)*(k+p) contains k as a substring, where p > 0 and p = A007954(k) is the product of digits of k.

Original entry on oeis.org

25, 28, 128, 225, 293, 678, 725, 742, 749, 4225, 4421, 6225, 8926, 72225, 617371, 1985525, 3679518, 4381824, 6816771, 8572645, 9721317, 43872768, 54639413, 758873243, 5895396725, 7796276839, 8881527332, 9458237492, 9594769255, 9949621217, 25214163187, 31987487294
Offset: 1

Views

Author

Scott R. Shannon, May 05 2020

Keywords

Examples

			25 is a term as p = 2*5 = 10 and (25-10)*(25+10) = 525 which contains '25' as a substring.
8926 is a term as p = 8*9*2*6 = 864 and (8926-864)*(8926+864) = 78926980 which contains '8926' as a substring.
		

Crossrefs

Programs

  • PARI
    isokp(dx, d) = {if (!#setintersect(Set(dx), Set(d)), return (0)); for (i=1, #dx - #d + 1, if (vector(#d, k, dx[k+i-1]) == d, return(1)););}
    isokd(x, d, n) = {if (x==n, return (1)); my(dx = digits(x)); if (#dx < #d, return (0)); isokp(dx, d);}
    isok(n) = {my(d = digits(n), p = vecprod(d)); if (p>0, isokd((n-p)*(n+p), d, n));} \\ Michel Marcus, May 07 2020

Extensions

More terms from Giovanni Resta, May 07 2020

A307714 Product of digits is noncomposite.

Original entry on oeis.org

0, 1, 2, 3, 5, 7, 11, 12, 13, 15, 17, 21, 31, 51, 71, 111, 112, 113, 115, 117, 121, 131, 151, 171, 211, 311, 511, 711, 1111, 1112, 1113, 1115, 1117, 1121, 1131, 1151, 1171, 1211, 1311, 1511, 1711, 2111, 3111, 5111, 7111, 11111, 11112, 11113, 11115, 11117, 11121, 11131, 11151, 11171, 11211
Offset: 1

Views

Author

M. F. Hasler, Apr 23 2019

Keywords

Comments

Either all digits are '1', or one of the digits can be a prime (2, 3, 5, 7).
The initial 0 is included by convention. (Some authors consider that the decimal expansion of 0 is the empty sum (0 has no digits) whence the product of digits is 1.)
This is the union of repunits A002275 and numbers whose product of digit is prime, A028842.

Crossrefs

Cf. A008578 (noncomposite numbers), A002275 (repunits), A117835 (primes in this sequence).

Programs

  • PARI
    select( is(n)={isprime(n=vecprod(digits(n)))||n==1}, [0..1999]) \\ In older PARI versions, vecprod=factorback.
    next_A307714(n,d)={if(n<3||Set(d=digits(n))==[1], n+1, fromdigits(apply(t->if(t<2, 1, t<7, nextprime(t+1),11), d)))}
    A307714_vec(N=99)=vector(N,i,t=if(i>1,next_A307714(t),0))
Showing 1-10 of 10 results.