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

A062339 Primes whose sum of digits is 4.

Original entry on oeis.org

13, 31, 103, 211, 1021, 1201, 2011, 3001, 10111, 20011, 20101, 21001, 100003, 102001, 1000003, 1011001, 1020001, 1100101, 2100001, 10010101, 10100011, 20001001, 30000001, 101001001, 200001001, 1000000021, 1000001011, 1000010101, 1000020001, 1000200001, 1002000001, 1010000011
Offset: 1

Views

Author

Amarnath Murthy, Jun 21 2001

Keywords

Comments

Is this sequence (and its brothers A062337, A062341 and A062343) infinite?
10^A049054(m)+3 and 3*10^A056807(m)+1 are subsequences. A107715 (primes containing only digits from set {0,1,2,3}) is a supersequence. Terms not containing the digit 3 are either terms of A020449 (primes that contain digits 0 and 1 only) or of A106100 (primes with maximal digit 2) - and thus terms of these sequences' union A036953 (primes containing only digits from set {0,1,2}). - Rick L. Shepherd, May 23 2005

Examples

			3001 is a prime with sum of digits = 4, hence belongs to the sequence.
		

Crossrefs

Subsequence of A062338, A107288, and A107715 (primes with digits <= 3).
A159352 is a subsequence.
Cf. A000040 (primes), A052218 (digit sum = 4), A061239 (primes == 4 (mod 9)).
Cf. Primes p with digital sum equal to k: {2, 11 and 101} for k=2; this sequence (k=4), A062341 (k=5), A062337 (k=7), A062343 (k=8), A107579 (k=10), A106754 (k=11), A106755 (k=13), A106756 (k=14), A106757 (k=16), A106758 (k=17), A106759 (k=19), A106760 (k=20), A106761 (k=22), A106762 (k=23), A106763 (k=25), A106764 (k=26), A048517 (k=28), A106766 (k=29), A106767 (k=31), A106768 (k=32), A106769 (k=34), A106770 (k=35), A106771 (k=37), A106772 (k=38), A106773 (k=40), A106774 (k=41), A106775 (k=43), A106776 (k=44), A106777 (k=46), A106778 (k=47), A106779 (k=49), A106780 (k=50), A106781 (k=52), A106782 (k=53), A106783 (k=55), A106784 (k=56), A106785 (k=58), A106786 (k=59), A106787 (k=61), A107617 (k=62), A107618 (k=64), A107619 (k=65), A106807 (k=67), A244918 (k=68), A181321 (k=70).
Cf. A049054 (10^k+3 is prime), A159352 (these primes).
Cf. A056807 (3*10^k+1 is prime), A259866 (these primes).
Cf. A020449 (primes with digits 0 and 1), A036953 (primes with digits <= 2), A106100 (primes with largest digit = 2), A069663, A069664 (smallest resp. largest n-digit prime with minimum digit sum).

Programs

  • Magma
    [p: p in PrimesUpTo(800000000) | &+Intseq(p) eq 4]; // Vincenzo Librandi, Jul 08 2014
  • Maple
    N:= 20: # to get all terms < 10^N
    B[1]:= {1}:
    B[2]:= {2}:
    B[3]:= {3}:
    A:= {}:
    for d from 2 to N do
       B[4]:= map(t -> 10*t+1,B[3]) union  map(t -> 10*t+3,B[1]);
       B[3]:= map(t -> 10*t, B[3]) union map(t -> 10*t+1,B[2]) union map(t -> 10*t+2,B[1]);
       B[2]:= map(t -> 10*t, B[2]) union map(t -> 10*t+1,B[1]);
       B[1]:= map(t -> 10*t, B[1]);
       A:= A union select(isprime,B[4]);
    od:
    sort(convert(A,list)); # Robert Israel, Dec 28 2015
  • Mathematica
    Union[FromDigits/@Select[Flatten[Table[Tuples[{0,1,2,3},k],{k,9}],1],PrimeQ[FromDigits[#]]&&Total[#]==4&]] (* Jayanta Basu, May 19 2013 *)
    FromDigits/@Select[Tuples[{0,1,2,3},10],Total[#]==4&&PrimeQ[FromDigits[#]]&] (* Harvey P. Dale, Jul 23 2025 *)
  • PARI
    for(a=1,20,for(b=0,a,for(c=0,b,if(isprime(k=10^a+10^b+10^c+1),print1(k", "))))) \\ Charles R Greathouse IV, Jul 26 2011
    
  • PARI
    select( {is_A062339(p,s=4)=sumdigits(p)==s&&isprime(p)}, primes([1,10^7])) \\ 2nd optional parameter for similar sequences with other digit sums. M. F. Hasler, Mar 09 2022
    
  • PARI
    A062339_upto_length(L,s=4,a=List(),u=[10^(L-k)|k<-[1..L]])=forvec(d=[[1,L]|i<-[1..s]], isprime(p=vecsum(vecextract(u,d))) && listput(a,p),1); Vecrev(a) \\ M. F. Hasler, Mar 09 2022
    

Formula

Intersection of A052218 (digit sum 4) and A000040 (primes). - M. F. Hasler, Mar 09 2022

Extensions

Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jul 06 2001
More terms from Rick L. Shepherd, May 23 2005
More terms from Lekraj Beedassy, Dec 19 2007

A062341 Primes whose sum of digits is 5.

Original entry on oeis.org

5, 23, 41, 113, 131, 311, 401, 1013, 1031, 1103, 1301, 2003, 2111, 3011, 4001, 10103, 10211, 10301, 11003, 12011, 12101, 13001, 20021, 20201, 21011, 21101, 30011, 100103, 101021, 101111, 102101, 103001, 120011, 121001, 200003, 200201, 201011, 201101, 202001
Offset: 1

Views

Author

Amarnath Murthy, Jun 21 2001

Keywords

Examples

			1301 belongs to the sequence since it is a prime with sum of digits = 5.
		

Crossrefs

Cf. A000040 (primes), A007953 (sum of digits), A052219 (digit sum = 5).
Cf. A062339 (same for digit sum s = 4), A062337 (s = 7), and others listed in A244918 (s = 68).
Subsequence of A062340 (primes with sum of digits divisible by 5).

Programs

  • Magma
    [p: p in PrimesUpTo(250000) | &+Intseq(p) eq 5]; // Vincenzo Librandi, Jul 08 2014
    
  • Maple
    T:= n-> `if`(n=1, 5, sort(select(isprime, [seq(seq(seq(
        10^(n-1)+1+10^i+10^j+10^k, k=1..j), j=1..i), i=1..n-1),
        seq(10^(n-1)+3+10^i, i=1..n-1)]))[]):
    seq(T(n), n=1..8);  # Alois P. Heinz, Dec 28 2015
  • Mathematica
    Select[Prime[Range[20000]],Total[IntegerDigits[#]]==5&] (* Harvey P. Dale, Nov 24 2013 *)
  • PARI
    \\ From M. F. Hasler, Mar 09 2022: (Start)
    select( {is_A062341(p,s=5)=sumdigits(p)==s&&isprime(p)}, primes([1,10^6])) \\ 2nd optional parameter for similar sequences with other digit sums.
    A062341_upto_length(L,s=5,a=List(),u=[10^k|k<-[0..L-1]])={forvec(d=[[1,L]|i<-[1..s]], isprime(p=vecsum(vecextract(u,d))) && listput(a,p),1); Set(a)} \\ (End)
  • Python
    from sympy import primerange as primes
    def ok(p): return sum(map(int, str(p))) == 5
    print(list(filter(ok, primes(1, 202002)))) # Michael S. Branicky, May 23 2021
    

Formula

Intersection of A000040 (primes) with A052219 (digit sum 5). - M. F. Hasler, Mar 09 2022

Extensions

Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jul 06 2001

A062343 Primes whose sum of digits is 8.

Original entry on oeis.org

17, 53, 71, 107, 233, 251, 431, 503, 521, 701, 1061, 1151, 1223, 1511, 1601, 2141, 2213, 2411, 3023, 3041, 3203, 3221, 4013, 4211, 5003, 5021, 6011, 6101, 7001, 10007, 10061, 10133, 10151, 10223, 10313, 10331, 10601, 11213, 11321, 11411
Offset: 1

Views

Author

Amarnath Murthy, Jun 21 2001

Keywords

Examples

			1151 belongs to the sequence since it is a prime with sum of digits = 8.
		

Crossrefs

Cf. A000040 (primes), A007953 (sum of digits), A052222 (digit sum = 8).
Cf. A062339 (same for digit sum s = 4), A062341 (s = 5), A062337 (s = 7), A107579 (s = 10), and others listed in A244918 (s = 68).
Subsequence of A062342 (primes with digit sum divisible by 8).

Programs

  • Magma
    [p: p in PrimesUpTo(20000) | &+Intseq(p) eq 8]; // Vincenzo Librandi, Jul 08 2014
    
  • Maple
    A062343 := proc(n)
        option remember ;
        local p ;
        if n = 1 then
            17;
        else
            p := nextprime(procname(n-1)) ;
            while true do
                if digsum(p) = 8 then # digsum in oeis.org/transforms.txt
                    return p;
                else
                    p := nextprime(p) ;
                end if;
            end do:
        end if;
    end proc:
    seq(A062343(n),n=1..80) ; # R. J. Mathar, May 22 2025
  • Mathematica
    Select[Prime[Range[500000]], Total[IntegerDigits[#]]==8 &] (* Vincenzo Librandi, Jul 08 2014 *)
  • PARI
    select( {is_A062343(p, s=8)=sumdigits(p)==s&&isprime(p)}, primes([1, 12345])) \\ 2nd optional parameter for similar sequences with other digit sums. M. F. Hasler, Mar 09 2022
    
  • PARI
    {A062343_upto_length(L, s=8, a=List(), u=[10^(L-k)|k<-[1..L]])=forvec(d=[[1, L]|i<-[1..s]], isprime(p=vecsum(vecextract(u, d))) && listput(a, p), 1); Vecrev(a)} \\ M. F. Hasler, Mar 09 2022

Formula

Intersection of A000040 (primes) and A052222 (digit sum 8). - M. F. Hasler, Mar 09 2022

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Jul 06 2001

A107579 Primes with digit sum 10.

Original entry on oeis.org

19, 37, 73, 109, 127, 163, 181, 271, 307, 433, 523, 541, 613, 631, 811, 1009, 1063, 1117, 1153, 1171, 1423, 1531, 1621, 1801, 2017, 2053, 2143, 2161, 2251, 2341, 2503, 2521, 3061, 3313, 3331, 3511, 4051, 4231, 5023, 5113, 6121, 6211, 6301, 8011, 8101
Offset: 1

Views

Author

Zak Seidov, May 16 2005

Keywords

Comments

Subset of A061237 and A117674.

Crossrefs

Cf. A000040 (primes), A007953 (sum of digits), A052224 (digit sum = 10).
Cf. A061237 (sum of digits == 1 (mod 9)).
Subsequence of A062340 (primes with digit sum divisible by 5).
Cf. A062339 (same for digit sum s = 4), A062341 (s = 5), A062343 (s = 8), A106754 (s = 11), and others listed in A244918 (s = 68).

Programs

  • Magma
    [p: p in PrimesUpTo(10000) | &+Intseq(p) eq 10]; // Vincenzo Librandi, Jul 08 2014
    
  • Maple
    a:=proc(n) local nn: nn:=convert(n,base,10): if isprime(n)=true and add(nn[j], j=1..nops(nn))=10 then n else end if end proc: seq(a(n),n=1..10^4); # Emeric Deutsch, Mar 06 2008
  • Mathematica
    Select[Prime[Range[100000]], Total[IntegerDigits[#]]==10 &] (* Vincenzo Librandi, Jul 08 2014 *)
  • PARI
    forprime(p=19,8101,if(10==sumdigits(p),print(p","))) \\ Zak Seidov, Oct 08 2016
    
  • PARI
    (A107579_nxt(p)=until(isprime(p=A228915(p)),); p); A107579_first(N=100)=vector(N, i, p=if(i>1, A107579_nxt(p), 19)) \\ M. F. Hasler, Mar 15 2022
    
  • Python
    from itertools import count, islice
    from sympy import isprime
    from sympy.utilities.iterables import multiset_permutations
    def agen(b=10, sod=10): # generator for any base, sum-of-digits
        if 0 <= sod < b:
            yield sod
        nzdigs = [i for i in range(1, b) if i <= sod]
        nzmultiset = []
        for d in range(1, b):
            nzmultiset += [d]*(sod//d)
        for d in count(2):
            fullmultiset = [0]*(d-1-(sod-1)//(b-1)) + nzmultiset
            for firstdig in nzdigs:
                target_sum, restmultiset = sod - int(firstdig), fullmultiset[:]
                restmultiset.remove(firstdig)
                for p in multiset_permutations(restmultiset, d-1):
                    if sum(p) == target_sum:
                        t = int("".join(map(str, [firstdig]+p)), b)
                        if isprime(t):
                            yield t
                        if p[0] == target_sum:
                            break
    print(list(islice(agen(), 45))) # Michael S. Branicky, Mar 10 2022
    
  • Python
    from sympy import isprime
    def A107579(p=19):
        "Return a generator of the sequence of all primes >= p with the same digit sum as p."
        while True:
            if isprime(p): yield p
            p = A228915(p) # skip to next larger integer with the same digit sum
    a=A107579(); [next(a) for  in range(50)] # _M. F. Hasler, Mar 16 2022

Formula

Intersection of A000040 (primes) and A052224 (digit sum = 10). - M. F. Hasler, Mar 09 2022

Extensions

Edited by N. J. A. Sloane, Feb 20 2009 at the suggestion of Pacha Nambi

A062337 Primes whose sum of digits is 7.

Original entry on oeis.org

7, 43, 61, 151, 223, 241, 313, 331, 421, 601, 1033, 1051, 1123, 1213, 1231, 1303, 1321, 2113, 2131, 2203, 2221, 2311, 3121, 3301, 4003, 4021, 4111, 4201, 5011, 5101, 10141, 10303, 10321, 10501, 11113, 11131, 11311, 12211, 12301, 13003, 14011, 20023, 20113
Offset: 1

Views

Author

Amarnath Murthy, Jun 21 2001

Keywords

Comments

There are O((log n)^6) members of this sequence below n.

Examples

			601 is a prime with sum of the digits = 7, hence belongs to the sequence.
		

Crossrefs

Subsequence of A062336. See also A000579, A118703 (no digit 0)
Cf. similar sequences listed in A244918.

Programs

  • Magma
    [p: p in PrimesUpTo(250000) | &+Intseq(p) eq 7]; // Vincenzo Librandi, Jul 08 2014
  • Maple
    A062337 := proc(n)
        option remember ;
        local p ;
        if n = 1 then
            7;
        else
            p := nextprime(procname(n-1)) ;
            while true do
                if digsum(p) = 7 then # digsum in oeis.org/transforms.txt
                    return p;
                else
                    p := nextprime(p) ;
                end if;
            end do:
        end if;
    end proc:
    seq(A062337(n),n=1..80) ; # R. J. Mathar, May 22 2025
  • Mathematica
    Select[Prime[Range[3000]], Plus @@ IntegerDigits[ # ] == 7 &] (* Zak Seidov, Feb 17 2005 *)
  • PARI
    A062337(lim)={my(pow=ceil(log(floor(lim)-.5)/log(10)),n);print("Checking for members of A062337 up to 10^"pow);for(a=0,pow-1,for(b=0,a,for(c=0,b,for(d=0,c,for(e=0,d,for(f=0,e,n=10^a+10^b+10^c+10^d+10^e+10^f+1;if(isprime(n),print1(n","))))))))};
    
  • PARI
    select( {is_A062337(p, s=7)=sumdigits(p)==s&&isprime(p)}, primes([1, 14321])) \\ 2nd optional parameter for similar sequences with other digit sums. M. F. Hasler, Mar 09 2022
    
  • PARI
    {A062337_upto_length(L, s=7, a=List(), u=[10^(L-k)|k<-[1..L]])=forvec(d=[[1, L]|i<-[1..s]], isprime(p=vecsum(vecextract(u, d))) && listput(a, p), 1); Vecrev(a)} \\ M. F. Hasler, Mar 09 2022
    

Formula

Intersection of A000040 (primes) and A052221 (digit sum 7). - M. F. Hasler, Mar 09 2022

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Jul 06 2001
Comments and program from Charles R Greathouse IV, Sep 11 2009

A106754 Primes p with digital sum equal to 11.

Original entry on oeis.org

29, 47, 83, 137, 173, 191, 227, 263, 281, 317, 353, 443, 461, 641, 821, 911, 1019, 1091, 1109, 1163, 1181, 1217, 1307, 1361, 1433, 1451, 1523, 1613, 1721, 1811, 1901, 2027, 2063, 2081, 2153, 2207, 2243, 2333, 2351, 2423, 2441, 2531, 2621, 2711, 2801, 3251
Offset: 1

Views

Author

Zak Seidov, May 16 2005

Keywords

Crossrefs

Cf. A000040 (primes), A007953 (sum of digits), A166311 (digit sum = 11).
Cf. A062339 (same for digit sum s = 4), ..., A107579 (s = 10), A106755 (s = 13), and others listed in A244918 (s = 68).
Subsequence of A119891 (prime trios: chain of prime sums of digits; also has as subsequence A106762 (s = 23), A106774 (s = 41), etc).

Programs

  • Magma
    [p: p in PrimesUpTo(10000) | &+Intseq(p) eq 11]; // Vincenzo Librandi, Jul 08 2014
    
  • Mathematica
    Select[Prime[Range[100000]], Total[IntegerDigits[#]]==11 &] (* Vincenzo Librandi, Jul 08 2014 *)
  • PARI
    select( {is_A106754(n)=sumdigits(n)==11&&isprime(n)}, primes([1, 3333])) \\ M. F. Hasler, Mar 09 2022

Formula

Intersection of A000040 (primes) and A166311 (digit sum = 11), also equals { p in A000040 | A007953(p) = 11 }. - M. F. Hasler, Mar 09 2022

A106787 Primes with digit sum = 61.

Original entry on oeis.org

8989999, 8999899, 9989899, 9999889, 16999999, 17989999, 17999899, 18889999, 18899899, 18899989, 18979999, 18989899, 18998899, 18999889, 18999979, 18999997, 19889899, 19899889, 19979899, 19987999, 19988989, 19989997, 19999789, 19999897, 26998999, 27799999
Offset: 1

Views

Author

Zak Seidov, May 16 2005

Keywords

Crossrefs

Cf, similar sequences listed in A244918.

Programs

  • Magma
    [p: p in PrimesUpTo(30000000) | &+Intseq(p) eq 61]; // Vincenzo Librandi, Jul 09 2014
  • Mathematica
    Select[Prime[Range[3000000]], Total[IntegerDigits[#]]==61 &] (* Vincenzo Librandi, Jul 09 2014 *)
  • PARI
    isok(n) = isprime(n) && (sumdigits(n) == 61); \\ Michel Marcus, Oct 09 2013
    

Extensions

More terms from Joshua Zucker, May 17 2006
More terms from Michel Marcus, Oct 05 2013

A107618 Primes with digit sum = 64.

Original entry on oeis.org

19999999, 29999899, 29999989, 39979999, 39999979, 47999899, 48899899, 48989989, 48997999, 48999799, 48999889, 49989799, 49999699, 49999897, 56999989, 58799899, 58898989, 58988899, 58997899, 59698999, 59788999
Offset: 1

Views

Author

Zak Seidov, May 18 2005

Keywords

Crossrefs

Cf. similar sequences listed in A244918.

Programs

  • Magma
    [p: p in PrimesUpTo(69000000) | &+Intseq(p) eq 64]; // Vincenzo Librandi, Jul 09 2014
  • Mathematica
    Select[Prime[Range[3600000]],Total[IntegerDigits[#]]==64&] (* Harvey P. Dale, Jan 19 2012 *)

A106760 Primes with digit sum = 20.

Original entry on oeis.org

389, 479, 569, 587, 659, 677, 839, 857, 929, 947, 983, 1289, 1487, 1559, 1667, 1847, 1973, 2099, 2297, 2459, 2477, 2549, 2657, 2693, 2729, 2819, 2837, 2909, 2927, 2963, 3089, 3359, 3449, 3467, 3539, 3557, 3593, 3719, 3863, 3881, 3917, 4079, 4259, 4349
Offset: 1

Views

Author

Zak Seidov, May 16 2005

Keywords

Crossrefs

Cf. similar sequences listed in A244918.

Programs

  • Magma
    [p: p in PrimesUpTo(5000) | &+Intseq(p) eq 20]; // Vincenzo Librandi, Jul 08 2014
  • Mathematica
    Select[Prime[Range[2000]], Total[IntegerDigits[#]]==20 &] (* Vincenzo Librandi, Jul 08 2014 *)

A107617 Primes with digit sum = 62.

Original entry on oeis.org

9899999, 18899999, 18999989, 19899989, 19998899, 19998989, 27989999, 27999899, 28998989, 28999979, 29789999, 29798999, 29969999, 29979899, 29988899, 29988989, 29989889, 29997899, 29998799, 29998889, 29999699, 36998999
Offset: 1

Views

Author

Zak Seidov, May 18 2005

Keywords

Crossrefs

Cf. similar sequences listed in A244918.

Programs

  • Magma
    [p: p in PrimesUpTo(38000000) | &+Intseq(p) eq 62]; // Vincenzo Librandi, Jul 09 2014
  • Mathematica
    Select[Prime[Range[600000]], Total[IntegerDigits[#]]==62 &] (* Vincenzo Librandi, Jul 09 2014 *)
Showing 1-10 of 42 results. Next