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.

Previous Showing 11-20 of 34 results. Next

A052022 Smallest number m larger than prime(n) such that prime(n) = sum of digits of m and prime(n) = largest prime factor of m (or 0 if no such number exists).

Original entry on oeis.org

12, 50, 70, 308, 364, 476, 1729, 4784, 9947, 8959, 38998, 588965, 179998, 1879859, 5988788, 38778989, 79693999, 287978998, 1489989599, 4595969989, 6888999949, 45999897788, 197999598599, 3999966997975, 6849998899886, 7885998969988, 35889999789995, 39969896999968
Offset: 2

Views

Author

Patrick De Geest, Nov 15 1999

Keywords

Comments

Does there exist a solution for every prime p?

Examples

			p=43 -> a(14)=179998 -> 1+7+9+9+9+8 = 43 and 179998 = 2*7*13*23*43. p=47 -> a(15)=1879859 -> 1+8+7+9+8+5+9 = 47 and 1879859 = 23*37*47*47.
		

Crossrefs

Programs

  • Maple
    A052022(n) = {
      local( p,m );
      p=prime(n) ;
      for(k=2,1000000000,
        m=k*p;
        if( A007953(m) == p && A006530(m) == p,
            return(m) ;
        )
      ) ;
    } # R. J. Mathar, Mar 02 2012
  • Mathematica
    snm[n_]:=Module[{k=2,p=Prime[n],m},m=k p;While[Total[ IntegerDigits[ m]]!=p||FactorInteger[m][[-1,1]]!=p,k++;m=k p];m]; Array[snm,18,2] (* Harvey P. Dale, Feb 28 2012 *)
  • PARI
    a(n) = my(p=prime(n), k=2, m=k*p); while ((sumdigits(m) != p) || (vecmax(factor(m)[,1]) != p), k++; m = k*p); m; \\ Michel Marcus, Apr 09 2021

Extensions

a(20)-a(29) from Donovan Johnson, May 09 2012

A028835 Numbers whose iterated 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, 39, 41, 43, 47, 48, 50, 52, 56, 57, 59, 61, 65, 66, 68, 70, 74, 75, 77, 79, 83, 84, 86, 88, 92, 93, 95, 97, 101, 102, 104, 106, 110, 111, 113, 115, 119, 120, 122, 124, 128, 129, 131, 133, 137, 138, 140, 142, 146, 147, 149, 151, 155, 156
Offset: 1

Views

Author

Keywords

Comments

Also numbers k such that k mod 9 is an element of {2,3,5,7}. Hence as n tends to infinity, a(n)/n converges to 9/4 quite rapidly. - Stefan Steinerberger, Apr 23 2006

Examples

			38 -> 3 + 8 = 11 -> 1 + 1 = 2 is a prime.
		

Crossrefs

Programs

  • Haskell
    import Data.List (findIndices)
    a028835 n = a028835_list !! (n-1)
    a028835_list = findIndices (`elem` [2,3,5,7]) $ map a010888 [0..]
    -- Reinhard Zumkeller, Oct 21 2011
  • Mathematica
    Select[Range[200], PrimeQ[Mod[ #, 9]] &] (* Stefan Steinerberger, Apr 23 2006 *)

Extensions

Extended (and corrected) by Scott Lindhurst (ScottL(AT)alumni.princeton.edu)

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

A252996 Magnanimous numbers: numbers such that the sum obtained by inserting a "+" anywhere between two digits gives a prime.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 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, 110, 112, 116, 118, 130, 136, 152, 158, 170, 172, 203, 209, 221, 227, 229, 245, 265, 281, 310, 316, 334, 338, 356
Offset: 1

Views

Author

M. F. Hasler, Dec 25 2014

Keywords

Comments

Inclusion of the single-digit terms is conventional: here the property is voidly satisfied since no sum can be constructed by inserting a + sign between two digits, therefore all possible sums are prime. (It is not allowed to prefix a leading zero (e.g., to forbid 4 = 04 = 0+4) since in that case all terms must be prime and one would get A089392.)
All terms different from 20 and not of the form 10^k+1 have the last digit of opposite parity than that of all other digits.
The sequence is marked as "finite", although we do not have a rigorous proof for this, only very strong evidence (numerical and probabilistic). G. Resta has checked that up to 5e16 the only magnanimous numbers with more than 11 digits are 5391391551358 and 97393713331910, the latter being probably the largest element of this sequence. In that case the 10+33+79+104+112+96+71+35+18+6+5+0+1+1 = 571 terms listed in Wilson's b-file are the complete list, which is what the keyword "full" stands for.

Examples

			245 is in the sequence because the numbers 2 + 45 = 47 and 24 + 5 = 29 are both prime. See the first comment for the single-digit terms.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local d;
      for d from 1 to ilog10(n)-1 do
        if not isprime(floor(n/10^d)+(n mod 10^d)) then return false fi
      od:
      true
    end proc:
    select(filter, [$0..10^5]); # Robert Israel, Dec 25 2014
  • Mathematica
    fQ[n_] := Block[{idn = IntegerDigits@ n, lng = Floor@ Log10@ n}, Union@ PrimeQ@ Table[ FromDigits[ Take[ idn, i]] + FromDigits[ Take[ idn, -lng + i -1]], {i, lng}] == {True}]; (* or *)
    fQ[n_] := Block[{lng = Floor@ Log10@ n}, Union@ PrimeQ[ Table[ Floor[n/10^k] + Mod[n, 10^k], {k, lng}]] == {True}];
    fQ[2] = fQ[3] = fQ[5] = fQ[7] = True; Select[ Range@ 500, fQ]
    (* Robert G. Wilson v, Dec 26 2014 *)
    mnQ[n_]:=AllTrue[Total/@Table[FromDigits/@TakeDrop[IntegerDigits[n],i],{i,IntegerLength[n]-1}],PrimeQ]; Join[Range[0,9],Select[Range[ 10,400], mnQ]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 26 2017 *)
  • PARI
    is(n)={!for(i=1,#Str(n)-1,ispseudoprime([1,1]*(divrem(n,10^i)))||return)}
    t=0;vector(100,i,until(is(t++),);t)
    
  • Python
    from sympy import isprime
    def ok(n):
        s = str(n)
        return all(isprime(int(s[:i])+int(s[i:])) for i in range(1, len(s)))
    print([k for k in range(357) if ok(k)]) # Michael S. Branicky, Oct 14 2024

A227823 Numbers n with property that each sum of any k-subsequence of digits of n with k>=2 is prime.

Original entry on oeis.org

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, 111, 203, 205, 230, 250, 302, 320, 502, 520
Offset: 1

Views

Author

Derek Orr, Jul 31 2013

Keywords

Comments

111 is the only number > 100 with all nonzero digits.

Examples

			203 is in the sequence because 2+0=2, 2+3=5, 0+3=3, 2+0+3=5 and 2,3,5 are all prime.
		

Crossrefs

Numbers are contained in both A028834 and A221699.

A252495 Restricted magnanimous numbers: numbers such that the sum obtained by inserting a "+" anywhere between two digits gives a prime, but no "leading zeros" may appear.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 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, 110, 112, 116, 118, 130, 136, 152, 158, 170, 172, 221, 227, 229, 245, 265, 281, 310, 316, 334, 338, 356
Offset: 1

Views

Author

M. F. Hasler, Dec 28 2014

Keywords

Comments

Inclusion of the single-digit terms is conventional: here the property is vacuously satisfied since no sum can be constructed by inserting a + sign between two digits, therefore all possible sums are prime. (It is not allowed to prefix a leading zero (e.g., to forbid 4 = 04 = 0+4) since in that case all terms must be prime and one would get A089392.)
The restriction on leading zeros means that numbers with digit 0 other than in the last position are excluded, so this sequence equals A252996 with terms in A252480 removed.
Since all primes > 2 are odd, all terms different from 11 and 20 have the last digit of opposite parity to that of all other digits.
As A252996, this sequence is "finite" (without rigorous proof), and up to 5e16 the only terms with more than 11 digits are 5391391551358 and 97393713331910, the latter being probably the largest element of this sequence (due to Giovanni Resta).
(See links for "intellectual ownership": The sequence (without single-digit terms) was suggested by Eric Angelini, a first list of terms computed by Lars Blomberg, then others. Hans Havermann observed that this is a variant of what had been termed "magnanimous numbers" at least 10 years ago by A. Murthy, G. Resta and/or C. Rivera, cf. A089392 and links.)

Examples

			110 is in the sequence since 1+10=11 and 11+0 = 11 are both prime.
101 is not in the sequence because although 10+1 = 11 and 1+01 = 2 are prime, the latter sum is forbidden since 01 has a leading zero.
Number, smallest and largest of the n-digit terms:
| n   #     min    max
| 1  10      0      9
| 2  33      11     98
| 3  69     110     998
| 4  90     1112    9910
| 5  81    11116    99998
| 6  71    111112   999994
| 7  54   1115756   9959374
| 8  25   11771992  95559998
| 9   9  117711170  995955112
|10   4  1777137770 9151995592
|11   4 22226226625 46884486265
|12   0  -
|13   1     5391391551358
|14   1     97393713331910
|15   0  -
		

Crossrefs

Programs

  • PARI
    is(n)=!for(i=1,#Str(n)-1,ispseudoprime([1,1]*(divrem(n,10^i)))||return)&&(n<100||vecmin(digits(n\10)))
    t=0;vector(100,i,until(is(t++),);t)

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

A070026 Initial, all intermediate and final iterated sums of digits of n are primes.

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, 50, 52, 56, 61, 65, 70, 74, 83, 92, 101, 102, 104, 106, 110, 111, 113, 115, 119, 120, 122, 124, 128, 131, 133, 137, 140, 142, 146, 151, 155, 160, 164, 173, 182, 191, 200, 201, 203, 205, 209, 210, 212, 214, 218
Offset: 1

Views

Author

Rick L. Shepherd, Apr 13 2002

Keywords

Comments

2999 = A062802(4) is the smallest term of this sequence for which the second iterated sum of digits is not the final sum; i.e. the smallest requiring three summations (2+9+9+9=29, 2+9=11, 1+1=2 and all three sums are prime). (The corresponding statement about the very large A062802(5) is not true because a large number of smaller nonprimes of the same digit length also have the digit sum 2999, the least being 29999..., where 333 9's follow the 2.). A062802, a sequence of primes, is a subsequence of this sequence and of A070027.
Additional terms can be generated by finding the next number whose digit sum is a prime already in the sequence. - Felix Fröhlich, Jun 13 2014

Examples

			47 is here because 4+7=11 and 11 is prime while also 1+1=2 and 2 is prime. 39 (in A028835) is not a term: 3+9=12 is not prime - although 1+2=3 is prime. 49 (in A028834) is not a term: 4+9=13 is prime but 1+3=4 is not prime.
		

Crossrefs

Cf. A028834 (Initial sum is prime), A028835 (Final sum is prime), A062802, A070027 (Primes from this sequence).

Extensions

Terms corrected by Felix Fröhlich, Jun 13 2014

A118571 Sophie Germain primes whose sum of digits is a prime.

Original entry on oeis.org

2, 3, 5, 11, 23, 29, 41, 83, 89, 113, 131, 173, 179, 191, 281, 359, 443, 593, 641, 683, 719, 809, 911, 953, 1013, 1019, 1031, 1103, 1439, 1451, 1499, 1583, 1811, 1901, 2003, 2063, 2069, 2339, 2351, 2393, 2399, 2753, 2939, 3299, 3329, 3389, 3413, 3491, 3761
Offset: 1

Views

Author

Luc Stevens (lms022(AT)yahoo.com), May 07 2006

Keywords

Examples

			191 is in the sequence because it is a Sophie Germain prime and the sum of its digits 1+9+1 = 11 is a prime.
		

Crossrefs

Intersection of A005384 and A028834.
Subsequence of A046704.

Programs

  • Mathematica
    Select[Range[4000], PrimeQ[#] && PrimeQ[2*# + 1] && PrimeQ[Plus @@ IntegerDigits[#]] &] (* Amiram Eldar, Feb 08 2021 *)
    Select[Prime[Range[600]],AllTrue[{2#+1,Total[IntegerDigits[#]]},PrimeQ]&] (* Harvey P. Dale, Mar 08 2025 *)

A135554 Numbers k such that k is the fourth power of an integer and the sum of digits of k is prime.

Original entry on oeis.org

16, 256, 625, 2401, 4096, 83521, 160000, 279841, 456976, 1048576, 1500625, 2560000, 2825761, 3748096, 4477456, 4879681, 5764801, 6250000, 7890481, 9834496, 11316496, 14776336, 16777216, 20151121, 21381376, 24010000, 28398241, 33362176, 40960000, 54700816
Offset: 1

Views

Author

Enoch Haga, Nov 25 2007

Keywords

Comments

Intersection of A000583 and A028834. - Michel Marcus, Oct 19 2016

Examples

			a(1)=16 because 2^4=16 and 1+6=7, prime.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[90]^4,PrimeQ[Total[IntegerDigits[#]]]&] (* Harvey P. Dale, Dec 13 2010 *)
  • PARI
    isok(n) = ispower(n,4) && isprime(sumdigits(n)); \\ Michel Marcus, Oct 19 2016

Extensions

Description corrected by Harvey P. Dale, Dec 13 2010
Previous Showing 11-20 of 34 results. Next