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.

A082257 Duplicate of A054750.

Original entry on oeis.org

2, 3, 5, 7, 29, 67, 89, 199, 599, 2999, 4999, 29989, 59999, 79999, 389999, 989999
Offset: 1

Views

Author

Keywords

A067180 Smallest prime with digit sum n, or 0 if no such prime exists.

Original entry on oeis.org

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

Views

Author

Amarnath Murthy, Jan 09 2002

Keywords

Examples

			a(68) = 59999999 because 59999999 is the smallest prime with digit sum = 68;
a(100) = 298999999999 because 298999999999 is the smallest prime with digit sum = 100.
		

Crossrefs

Cf. A054750.
Removal of the 0 terms from this sequence leaves A067523.

Programs

  • Maple
    g:= proc(s,d) # integers of <=d digits with sum s
      if s > 9*d then return [] fi;
      if d = 1 then return [s] fi;
      [seq(op(map(t -> j*10^(d-1)+ t, g(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(1):= 0: f(3):= 3:
    map(f, [$1..100]); # Robert Israel, Dec 13 2020
  • Mathematica
    a = Table[0, {100}]; Do[b = Apply[ Plus, IntegerDigits[ Prime[n]]]; If[b < 101 && a[[b]] == 0, a[[b]] = Prime[n]], {n, 1, 10^7} ]; a
    f[n_] :=  If[n > 5 && Mod[n, 3] == 0, 0, Block[{k = 1, lmt, lst = {}, ip = IntegerPartitions[n, Round[1 + n/9], {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}]}, lmt = 1 + Length@ ip; While[k < lmt, AppendTo[lst, Select[ FromDigits@# & /@ Permutations@ ip[[k]], PrimeQ[#] &]]; k++]; Min@ Flatten@ lst]]; f[1] = 0; f[4] = 13; Array[f, 70] (* Robert G. Wilson v, Sep 28 2014 *)
  • PARI
    A067180(n)={if(n<2, 0, n<4, n, n%3, my(d=divrem(n,9)); forprime(p=d[2]*10^d[1]-1,,sumdigits(p)==n&&return(p)))} \\ M. F. Hasler, Nov 04 2018

Formula

a(3k) = 0 for k > 1.
a(3k-2) = A067523(2k-1), a(3k-1) = A067523(2k), for all k > 1. - M. F. Hasler, Nov 04 2018

Extensions

Edited and extended by Robert G. Wilson v, Mar 01 2002
Edited by Ray Chandler, Apr 24 2007

A075360 Smallest prime (> n-th prime) with sum of digits = the n-th prime, or 0 if no such prime exists.

Original entry on oeis.org

11, 0, 23, 43, 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

Amarnath Murthy, Sep 19 2002

Keywords

Comments

From a(5) onwards the sequence is same as A054750.

Crossrefs

Cf. A054750.

A157712 Smallest prime made up of 0's and prime(n) 1's (or 0 when no such prime exists).

Original entry on oeis.org

11, 0, 101111, 11110111, 101111111111, 101101111111111, 101111111111111111, 1111111111111111111, 11111111111111111111111, 111110111111111111111111111111, 11111101111111111111111111111111
Offset: 1

Views

Author

Lekraj Beedassy, Mar 04 2009

Keywords

Comments

Smallest prime with digit sum A000040(n) and using only 0's and 1's. Subsequence of A157709.

Crossrefs

Cf. A054750.

Programs

  • Python
    from _future_ import division
    from itertools import combinations
    from sympy import prime, isprime
    def A157712(n):
        if n == 1:
            return 11
        if n == 2:
            return 0
        p = prime(n)
        l = p
        while True:
            for i in combinations(range(l),l-p):
                s = ['1']*l
                for x in i:
                    s[x] = '0'
                q = int(''.join(s))
                if isprime(q):
                    return q
            l += 1 # Chai Wah Wu, Nov 05 2015

Extensions

Extended by Ray Chandler, Mar 06 2009

A161551 The smallest composite number larger than the n-th composite number, which has a sum of digits equal to the n-th composite number.

Original entry on oeis.org

22, 15, 26, 18, 28, 39, 68, 69, 88, 99, 299, 399, 589, 699, 799, 899, 999, 2899, 3999, 5999, 6999, 7999, 9899, 9999, 29999, 39999, 58999, 69999, 89999, 99999, 299899, 399999, 499999, 689999, 699999, 889999, 999999, 1999999, 3899999, 3999999
Offset: 1

Views

Author

Enoch Haga, Jun 13 2009

Keywords

Comments

Variant of A073866, where the requirement that a(n) > A002808(n) is dropped.

Examples

			The first composite is 4, and the first sum of digits is 13, but since that is prime, we go to the next, 22, which being composite is a(1).
		

Crossrefs

Programs

  • Maple
    A161551 := proc(n)
        for j from n+1 do
            if digsum(A002808(j)) = A002808(n) then
                return A002808(j) ;
            end if;
        end do:
    end proc:
    seq(A161551(n),n=1..30) ; # R. J. Mathar, Dec 06 2011
  • UBASIC
    10 'compsdig, Enoch Haga, Jun 12 2009
    20 N=1
    30 Q=str(N)
    40 L=len(Q)
    50 for X=1 to L
    60 M=str(mid(Q,X,1)): Z=Z+val(mid(Q,X,1))
    70 next X
    80 if Z=56 and Z<>prmdiv(Z) and N<>prmdiv(N) then print N: stop
    90 Z=0: N=N+1: goto 30

Formula

min{c in A002808, c> A002808(n): A007953(c) = A002808(n)}. - R. J. Mathar, Dec 06 2011

A054797 Smallest prime number whose digits sum to the n-th palindromic prime.

Original entry on oeis.org

2, 3, 5, 7, 29, 399999998999, 789989999999999, 89989999999999999, 299999899999999999999, 4799999999999999999999, 88999999999999999999999999999999999, 3999899999999999999999999999999999999999, 689999999999999999999999999999999989999999, 6999989999999999999999999999999999999999999
Offset: 1

Views

Author

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

Keywords

Crossrefs

Extensions

a(6) added by Carlos Rivera
a(7) from David Consiglio, Jr., Nov 07 2011
a(8)-a(14) from David Consiglio, Jr., Nov 16 2011
a(10) corrected by Sean A. Irvine, Feb 23 2022

A055019 Numbers n such that A051885(p_n) is prime, where p_n=A000040(n) is the n-th prime.

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 20, 22, 25, 40, 41, 55, 57, 64, 77, 125, 663, 1053, 1414, 1711, 2822, 2956, 4107, 7463
Offset: 1

Views

Author

Kok Seng Chua (chuaks(AT)ihpc.nus.edu.sg), May 31 2000

Keywords

Comments

Numbers n such that A051885(A000040(n)) = A054750(n).
No other terms below 10^4.

Examples

			The 125th prime is 691. The least integer with sum of digits 691 is A051885(691) = 8*10^76-1 which is prime. This is the 22nd prime with this property, so a(22)=125.
		

Crossrefs

Programs

  • PARI
    for(X=1,300, a=prime(X)%9; b=prime(X)\9; m=(a+1)*10^b-1; if(isprime(m), print([X,prime(X),m]) ) )

Extensions

More terms from Jason Earls, Jun 22 2001
a(27)-a(30) from Max Alekseyev, Dec 09 2011

A382461 a(n) is the smallest number whose sum of digits is 2^n.

Original entry on oeis.org

1, 2, 4, 8, 79, 5999, 19999999, 299999999999999, 49999999999999999999999999999, 899999999999999999999999999999999999999999999999999999999, 799999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
Offset: 0

Views

Author

Stefano Spezia, Mar 27 2025

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_]:=10^(Floor[2^n/9])(1+2^n-9Floor[2^n/9])-1; Array[a,11,0]
  • Python
    def A382461(n): return (lambda x:(x[1]+1)*10**x[0]-1)(divmod(1<Chai Wah Wu, Mar 29 2025

Formula

a(n) = 10^(floor(2^n/9))*(1 + 2^n - 9*floor(2^n/9)) - 1.
a(n) = A051885(2^n).

A161561 The smallest number larger than n with digital sum equal to n.

Original entry on oeis.org

10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 29, 39, 49, 59, 69, 79, 89, 99, 199, 299, 399, 499, 599, 699, 799, 899, 999, 1999, 2999, 3999, 4999, 5999, 6999, 7999, 8999, 9999, 19999, 29999, 39999, 49999, 59999, 69999, 79999, 89999, 99999, 199999, 299999, 399999
Offset: 1

Views

Author

Enoch Haga, Jun 13 2009

Keywords

Examples

			a(4)=13 because the sums of digits of the candidates 5 to 12 are all different from n=4, and 13 is the first candidate with sum 1+3 = n = 4.
		

Crossrefs

Programs

  • Mathematica
    dsn[n_]:=Module[{k=n+1},While[Total[IntegerDigits[k]]!=n,k++];k]; Array[ dsn,50] (* Harvey P. Dale, Oct 24 2020 *)
  • PARI
    a(n) = my(m = n+1); while(sumdigits(m) != n, m++); m; \\ Michel Marcus, Jun 08 2014

Formula

a(n) = min{k>n: A007953(k) = n}.

Extensions

More precise definition from R. J. Mathar, Aug 30 2010

A346489 a(n) is the index of the smallest prime whose digits sum to n-th prime.

Original entry on oeis.org

1, 2, 3, 4, 10, 19, 24, 46, 109, 430, 669, 3245, 6057, 7837, 33067, 77777, 476643, 601855, 3556550, 5216954, 15739663, 41146179, 189961757, 882206624, 3325059246, 15581005618, 23007498153, 37607875618
Offset: 1

Views

Author

Ilya Gutkovskiy, Jul 19 2021

Keywords

Examples

			a(10) = 430 because prime(430) = 2999, 2 + 9 + 9 + 9 = 29 = prime(10) and this is the smallest such number.
		

Crossrefs

Programs

  • Mathematica
    Module[{nn=522*10^4,tbl},tbl=Table[{n,Total[IntegerDigits[Prime[n]]]},{n,nn}];Table[SelectFirst[tbl,#[[2]]==Prime[n]&],{n,20}]][[;;,1]] (* The program generates the first 20 terms of the sequence. *) (* Harvey P. Dale, Feb 19 2023 *)

Formula

a(n) = A000720(A054750(n)).
a(n) = min {k : A007605(k) = prime(n)}.
Showing 1-10 of 10 results.