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 12 results. Next

A007605 Sum of digits of n-th prime.

Original entry on oeis.org

2, 3, 5, 7, 2, 4, 8, 10, 5, 11, 4, 10, 5, 7, 11, 8, 14, 7, 13, 8, 10, 16, 11, 17, 16, 2, 4, 8, 10, 5, 10, 5, 11, 13, 14, 7, 13, 10, 14, 11, 17, 10, 11, 13, 17, 19, 4, 7, 11, 13, 8, 14, 7, 8, 14, 11, 17, 10, 16, 11, 13, 14, 10, 5, 7, 11, 7, 13, 14, 16, 11, 17, 16, 13, 19, 14, 20, 19, 5
Offset: 1

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a007605_list = map a007953 a000040_list -- Reinhard Zumkeller, Aug 04 2011
    
  • Magma
    [ &+Intseq(NthPrime(n), 10): n in [1..80] ]; // Klaus Brockhaus, Jun 13 2009
    
  • Maple
    map(t -> convert(convert(t,base,10),`+`), select(isprime, [2,(2*i+1 $ i=1..1000)])); # Robert Israel, Aug 16 2015
  • Mathematica
    Table[Apply[Plus, RealDigits[Prime[n]][[1]]], {n, 1, 100}]
    Plus@@ IntegerDigits[Prime[Range[100]]] (* Zak Seidov *)
  • PARI
    dsum(n)=my(s);while(n,s+=n%10;n\=10);s
    forprime(p=2,1e3,print1(dsum(p)", ")) \\ Charles R Greathouse IV, Jul 15 2011
    
  • PARI
    a(n) = sumdigits(prime(n)); \\ Michel Marcus, Dec 20 2017
    
  • Python
    from sympy import prime
    def a(n): return sum(map(int, str(prime(n))))
    print([a(n) for n in range(1, 80)]) # Michael S. Branicky, Feb 03 2021

Formula

a(n) = A007953(A000040(n)) = A007953(prime(n)).

A054750 Smallest prime number whose digits sum to n-th prime.

Original entry on oeis.org

2, 3, 5, 7, 29, 67, 89, 199, 599, 2999, 4999, 29989, 59999, 79999, 389999, 989999, 6999899, 8989999, 59899999, 89999999, 289999999, 799999999, 3999998999, 19999997999, 79999999999, 399999998999, 599999899999, 999998999999
Offset: 1

Views

Author

G. L. Honaker, Jr., Apr 24 2000

Keywords

Comments

a(n) >= A051885(A000040(n)). Indices n for which the equality holds are listed in A055019.
a(n) >= A046864(n). - Michel Marcus, Nov 01 2015

Examples

			a(7)=89 because 8+9=17 and 17 is the 7th prime.
		

Crossrefs

Programs

  • Mathematica
    a[n_]:=Module[{k=2}, While[DigitSum[k]!=Prime[n], k=NextPrime[k]]; k]; Array[a,15] (* Stefano Spezia, Mar 27 2025 *)
  • PARI
    a(n) = {my(k=2); my(p=prime(n)); while((sumdigits(k) != prime(n)), k=nextprime(k+1)); k;} \\ Michel Marcus, Nov 01 2015

Extensions

More terms from Kok Seng Chua (chuaks(AT)ihpc.nus.edu.sg), May 31 2000
Edited and extended by Robert G. Wilson v, Feb 26 2002

A067523 The smallest prime with a possible given digit sum.

Original entry on oeis.org

2, 3, 13, 5, 7, 17, 19, 29, 67, 59, 79, 89, 199, 389, 499, 599, 997, 1889, 1999, 2999, 4999, 6899, 17989, 8999, 29989, 39989, 49999, 59999, 79999, 98999, 199999, 389999, 598999, 599999, 799999, 989999, 2998999, 2999999, 4999999, 6999899, 8989999
Offset: 1

Views

Author

Amarnath Murthy, Feb 14 2002

Keywords

Comments

Except for 3 no other prime has a digit sum which is a multiple of 3. Hence the possible digit sums are 2,3,4,5,7,8,10,11,13,14,16,..., etc. Conjecture: For every possible digit sum there exists a prime.
For n > 2, this is (conjecturally) the smallest prime with digit sum A001651(n). - Lekraj Beedassy, Mar 04 2009

Crossrefs

Cf. A001651. Equals A067180 with the 0 terms removed.

Programs

  • Maple
    g:= proc(s, d) # integers of <=d digits with sum s
      local j;
      if s > 9*d then return [] fi;
      if d = 1 then return [s] fi;
      [seq(op(map(t -> j*10^(d-1)+ t, procname(s-j, d-1))), j=0..9)];
    end proc:
    f:= proc(n) local d, j, x, y;
      if n mod 3 = 0 then return 0 fi;
      for d from ceil(n/9) do
        if d = 1 then
          if isprime(n) and n < 10 then return n
          else next
        fi fi;
        for j from 1 to 9 do
           for y in g(n-j, d-1) do
             x:= 10^(d-1)*j + y;
             if isprime(x) then return x fi;
      od od od;
    end proc:
    f(3):= 3:
    map(f, [2,3,seq(seq(3*i+j,j=1..2),i=1..30)]); # Robert Israel, Jan 18 2024
  • PARI
    A067523(n)=if(n<3,n+1,A067180(n*3\/2-1)) \\ M. F. Hasler, Nov 04 2018

Formula

a(n) = min(prime(i): A007605(i) = A133223(i)). - R. J. Mathar, Nov 06 2018

Extensions

More terms from Vladeta Jovovic, Feb 18 2002
Edited by Ray Chandler, Apr 24 2007

A073867 Smallest prime whose digital sum is equal to the n-th composite number, or 0 if no such prime exists.

Original entry on oeis.org

13, 0, 17, 0, 19, 0, 59, 0, 79, 0, 389, 0, 499, 0, 997, 1889, 0, 1999, 0, 6899, 0, 17989, 8999, 0, 39989, 0, 49999, 0, 98999, 0, 199999, 0, 598999, 599999, 0, 799999, 0, 2998999, 2999999, 0, 4999999, 0, 9899999, 0, 19999999, 29999999, 0, 59999999, 0
Offset: 1

Views

Author

Amarnath Murthy, Aug 15 2002

Keywords

Examples

			The first composite number (A002808) is 4 and the least prime whose digital sum is 4 is 13.
The second composite number (A002808) is 6 whose digital sum is == 0 (mod 3) so there is no prime whose fits the definition.
		

Crossrefs

Equals A067180(A002808(n)). Cf. A111397.

Programs

  • Mathematica
    Composite[n_] := FixedPoint[n + PrimePi[ # ] + 1 &, n]; f[n_] := Block[{cn = Composite[n]}, k = 1; While[Plus @@ IntegerDigits@Prime@k != cn, k++ ]; Prime[k]];

Formula

a(n)=0 iff that composite number (A002808(n)) is congruent to 0 (modulo 3), otherwise a(n)=A007605(k) for the first k that equals A002808(n).

Extensions

a(19)-a(32) from Stefan Steinerberger, Nov 09 2005
a(33)-a(56) by Robert G. Wilson v, Nov 10 2005

A133223 Sum of digits of primes (A007605), sorted and with duplicates removed.

Original entry on oeis.org

2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32, 34, 35, 37, 38, 40, 41, 43, 44, 46, 47, 49, 50, 52, 53, 55, 56, 58, 59, 61, 62, 64, 65, 67, 68, 70, 71, 73, 74, 76, 77, 79, 80, 82, 83, 85, 86, 88, 89, 91, 92, 94, 95, 97, 98, 100, 101, 103
Offset: 1

Views

Author

Lekraj Beedassy, Dec 19 2007

Keywords

Comments

Presumably this is 3 together with numbers greater than 1 and not divisible by 3 (see A001651). - Charles R Greathouse IV, Jul 17 2013. (This is not a theorem because we do not know if, given s > 3 and not a multiple of 3, there is always a prime with digit-sum s. Cf. A067180, A067523. - N. J. A. Sloane, Nov 02 2018)
From Chai Wah Wu, Nov 04 2018: (Start)
Conjecture: for s > 10 and not a multiple of 3, there exists a prime with digit-sum s consisting only of the digits 2 and 3 (cf. A137269). This conjecture has been verified for s <= 2995.
Conjecture: for s > 18 and not a multiple of 3, there exists a prime with digit-sum s consisting only of the digits 3 and 4. This conjecture has been verified for s <= 1345.
Conjecture: for s > 90 and not a multiple of 3, there exists a prime with digit-sum s consisting only of the digits 8 and 9. This conjecture has been verified for s <= 8995.
Conjecture: for 0 < a < b < 10, gcd(a, b) = 1 and ab not a multiple of 10, if s > 90 and s is not a multiple of 3, then there exists a prime with digit-sum s consisting only of the digits a and b. (End)

Crossrefs

Extensions

Corrected by Jeremy Gardiner, Feb 09 2014

A213354 Primes p with digit sums s(p) and s(s(p)) also prime, but s(s(s(p))) not prime.

Original entry on oeis.org

59899999, 69899899, 69899989, 69979999, 69997999, 69999799, 77899999, 78997999, 78998989, 78999889, 78999979, 79699999, 79879999, 79889899, 79979899, 79979989, 79988899, 79989979, 79996999, 79997899, 79997989, 79999789, 79999879, 79999987
Offset: 1

Views

Author

Jonathan Sondow, Jun 10 2012

Keywords

Comments

A046704 is primes p with s(p) also prime. A207294 is primes p with s(p) and s(s(p)) also prime. A070027 is primes p with all s(p), s(s(p)), s(s(s(p))), ... also prime. A104213 is primes p with s(p) not prime. A207293 is primes p with s(p) also prime, but not s(s(p)). A213355 is smallest prime p whose k-fold digit sum s(s(..s(p)..)) is also prime for all k < n, but not for k = n.
Contains primes with digit sums 67, 89, 139, 157, 179,...., A207293(.). So A106807 is a subsequence and examples of numbers in this sequence but not in A106807 are A067180(89), A067180(139) etc. - R. J. Mathar, Feb 04 2021

Examples

			59899999 and s(59899999) = 5+9+8+9+9+9+9+9 = 67 and s(s(59899999)) = s(67) = 6+7 = 13 are all primes, but s(s(s(59899999))) = s(13) = 1+3 = 4 is not prime. No smaller prime has this property, so a(1) = 59899999 = A213355(3).
		

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[5000000]], PrimeQ[Apply[Plus, IntegerDigits[#]]] && PrimeQ[Apply[Plus, IntegerDigits[Apply[Plus, IntegerDigits[#]]]]] && ! PrimeQ[Apply[Plus, IntegerDigits[Apply[Plus, IntegerDigits[Apply[Plus, IntegerDigits[#]]]]]]] &]

A113625 Irregular triangle in which the n-th row contains all primes having digit sum n (not containing the digit '0') in increasing order.

Original entry on oeis.org

2, 11, 3, 13, 31, 211, 5, 23, 41, 113, 131, 311, 2111, 7, 43, 61, 151, 223, 241, 313, 331, 421, 1123, 1213, 1231, 1321, 2113, 2131, 2221, 2311, 3121, 4111, 11113, 11131, 11311, 12211, 21121, 21211, 22111, 111121, 111211, 112111, 17, 53, 71, 233, 251, 431, 521
Offset: 2

Views

Author

Amarnath Murthy, Nov 10 2005

Keywords

Comments

The number of primes in the n-th row is A073901(n). The smallest prime in the n-th row is A067180(n). The largest prime in the n-th row is A069869(n).

Examples

			Starting with row 2, the table is
2, 11
3
13, 31, 211
5, 23, 41, 113, 131, 311, 2111
none
7, 43, 61, 151, 223, 241, 313, 331, 421, 1123,...
		

Crossrefs

Cf. A110741 (with contraints on number of digits).

Programs

  • Maple
    with(combinat):
    b:= proc(n, i, l) option remember; `if`(n=0, select(isprime,
          map(x-> parse(cat(x[])), permute(l))), `if`(i<1, [],
          [seq(b(n-i*j, i-1, [l[],i$j])[], j=0..n/i)]))
        end:
    T:= n-> sort(b(n, 9, []))[]:
    seq(T(n), n=2..8);  # Alois P. Heinz, May 25 2013
  • Mathematica
    Table[If[n > 3 && Mod[n, 3] == 0, {}, p = IntegerPartitions[n]; u = {}; Do[t = Permutations[i]; u = Union[u, Select[FromDigits /@ t, PrimeQ]], {i, p}]; u], {n, 2, 14}]

Extensions

Edited, corrected and extended by Stefan Steinerberger, Aug 10 2007
Edited by T. D. Noe, Jan 25 2011

A268605 a(1) = 0; a(n+1) is the smallest integer in which the difference between its digits sum and the a(n) digits sum is equal to the n-th prime.

Original entry on oeis.org

0, 2, 5, 19, 89, 1999, 59999, 4999999, 599999999, 199999999999, 399999999999999, 799999999999999999, 8999999999999999999999, 499999999999999999999999999, 29999999999999999999999999999999, 4999999999999999999999999999999999999
Offset: 1

Views

Author

Francesco Di Matteo, Feb 17 2016

Keywords

Comments

First 8 terms are primes (and are also in A061248). Next terms are not always primes.

Examples

			a(4) = 19 and 1 + 9 = 10; so a(5) = 89 because 8 + 9 = 17 and 17 - 10 = 7, that is the 4th prime.
		

Crossrefs

Programs

  • PARI
    findnext(x, k) = {sx = sumdigits(x); pk = prime(k); y = 1; while (sumdigits(y) - sx != pk, y++); y;}
    lista(nn) = {print1(x = 0, ", "); for (k=1, nn, y = findnext(x, k); print1(y, ", "); x = y;);} \\ Michel Marcus, Feb 19 2016
  • Python
    sumprime = 0
    isPrime=lambda x: all(x % i != 0 for i in range(int(x**0.5)+1)[2:])
    print(0)
    for i in range(2,100):
      if isPrime(i):
        alfa = ""
        k = i + sumprime
        sumprime = k
        while k > 9:
          alfa = alfa + "9"
          k = k - 9
        alfa = str(k)+alfa
        print(alfa)
    

Formula

a(n) = A051885( A007504(n-1) ). - R. J. Mathar, Jun 19 2021

Extensions

NAME adapted to offset by R. J. Mathar, Jun 19 2021

A234429 Numbers which are the digital sum of the square of some prime.

Original entry on oeis.org

4, 7, 9, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 160, 163, 166, 169, 172, 175, 178
Offset: 1

Views

Author

Keywords

Comments

A123157 sorted and duplicates removed.

Crossrefs

Programs

  • PARI
    terms(nn) = {v = []; forprime (p = 1, nn, v = concat(v, sumdigits(p^2));); vecsort(v,,8);} \\ Michel Marcus, Jan 08 2014

Formula

From Robert G. Wilson v, Sep 28 2014: (Start)
Except for 3, all primes are congruent to +-1 (mod 3). Therefore, (3n +- 1)^2 = 9n^2 +- 6n + 1 which is congruent to 1 (mod 3).
4: 2, 11, 101, ... (A062397);
7: 5, 149, 1049, ... (A226803);
9: only 3;
10: 19, 71, 179, 251, 449, 20249, 24499, 100549, ... (A226802);
13: 7, 29, 47, 61, 79, 151, 349, 389, 461, 601, 1051, 1249, 1429, ... (A165492);
16: 13, 23, 31, 41, 59, 103, 131, 139, 211, 229, 239, 347, 401, ... (A165459);
19: 17, 37, 53, 73, 89, 107, 109, 127, 181, 199, 269, 271, 379, ... (A165493);
22: 43, 97, 191, 227, 241, 317, 331, 353, 421, 439, 479, 569, 619, 641, ...;
25: 67, 113, 157, 193, 257, 283, 311, 337, 373, 409, 419, 463, ... (A229058);
28: 163, 197, 233, 307, 359, 397, 431, 467, 487, 523, 541, 577, 593, 631, ...;
31: 83, 137, 173, 223, 263, 277, 281, 367, 443, 457, 547, 587, ... (A165502);
34: 167, 293, 383, 563, 607, 617, 733, 787, 823, 859, 877, 941, 967, 977, ...;
37: 433, 613, 683, 773, 827, 863, 1063, 1117, 1187, 1223, 1567, ... (A165503);
40: 313, 947, 983, 1303, 1483, 1609, 1663, 1933, 1973, 1987, 2063, 2113, ...;
43: 887, 1697, 1723, 1867, 1913, 2083, 2137, 2417, 2543, 2633, ... (A165504);
46: 883, 937, 1367, 1637, 2213, 2447, 2683, 2791, 2917, 3313, 3583, 3833, ...;
49: 1667, 2383, 2437, 2617, 2963, 4219, 4457, 5087, 5281, 6113, 6163, ...;
... Also see A229058. (End)
Conjectures from Chai Wah Wu, Apr 16 2025: (Start)
a(n) = 2*a(n-1) - a(n-2) for n > 5.
G.f.: x*(2*x^4 - x^3 - x^2 - x + 4)/(x - 1)^2. (End)

Extensions

a(36) from Michel Marcus, Jan 08 2014
a(37)-a(54) from Robert G. Wilson v, Sep 28 2014
More terms from Giovanni Resta, Aug 15 2019

A114442 Least prime whose absolute difference between the sum of its even decimal digits and the sum of its odd decimal digits is n.

Original entry on oeis.org

211, 23, 2, 3, 13, 5, 127, 7, 17, 281, 19, 137, 277, 139, 59, 881, 79, 179, 11299, 199, 1559, 2797, 1399, 599, 12799, 997, 1979, 86861, 1999, 13799, 25999, 13999, 49999, 172999, 70999, 19979, 1199929, 39799, 137999, 277999, 139999, 59999, 1299979
Offset: 0

Views

Author

Zak Seidov and Robert G. Wilson v, Feb 04 2006

Keywords

Comments

When a(n) is not A067180(n) and n!=0 (mod 3): 1, 11, 13, 17, 20, 22, 26, 29, 31, 32, 34, 35, 37, 38, 40, 44, 47, 49, 53, 55, 56, 58, 59, 61, 62, 65, 67, 70, 71, 73, 74, 76, 77, 80, 82, 83, ....

Examples

			a(0)=211 since 211 is the least prime which meets the criterion; i.e., |2 - (1+1)| = 0.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{id = IntegerDigits@Prime@n}, Abs[(Plus @@ id) - 2Plus @@ Select[id, OddQ]]]; t = Table[0, {50}]; Do[ a = f[n]; If[ t[[a + 1]] == 0, t[[a + 1]] = n], {n, 100020}]; t
Showing 1-10 of 12 results. Next