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

A052224 Numbers whose sum of digits is 10.

Original entry on oeis.org

19, 28, 37, 46, 55, 64, 73, 82, 91, 109, 118, 127, 136, 145, 154, 163, 172, 181, 190, 208, 217, 226, 235, 244, 253, 262, 271, 280, 307, 316, 325, 334, 343, 352, 361, 370, 406, 415, 424, 433, 442, 451, 460, 505, 514, 523, 532, 541, 550, 604, 613, 622, 631, 640
Offset: 1

Views

Author

Henry Bottomley, Feb 01 2000

Keywords

Comments

Proper subsequence of A017173. - Rick L. Shepherd, Jan 12 2009
Subsequence of A227793. - Michel Marcus, Sep 23 2013
A007953(a(n)) = 10; number of repdigits = #{55,22222,1^10} = A242627(10) = 3. - Reinhard Zumkeller, Jul 17 2014
a(n) = A094677(n) for n = 1..28. - Reinhard Zumkeller, Nov 08 2015
The number of terms having <= m digits is the coefficient of x^10 in sum(i=0,9,x^i)^m = ((1-x^10)/(1-x))^m. - David A. Corneth, Jun 04 2016
In general, the set of numbers with sum of base-b digits equal to b is a subset of { (b-1)*k + 1; k = 2, 3, 4, ... }. - M. F. Hasler, Dec 23 2016

Crossrefs

Cf. A011557 (1), A052216 (2), A052217 (3), A052218 (4), A052219 (5), A052220 (6), A052221 (7), A052222 (8), A052223 (9), A166311 (11), A235151 (12), A143164 (13), A235225 (14), A235226 (15), A235227 (16), A166370 (17), A235228 (18), A166459 (19), A235229 (20).
Cf. A094677.
Sum of base-b digits equal b: A226636 (b = 3), A226969 (b = 4), A227062 (b = 5), A227080 (b = 6), A227092 (b = 7), A227095 (b = 8), A227238 (b = 9).

Programs

  • Haskell
    a052224 n = a052224_list !! (n-1)
    a052224_list = filter ((== 10) . a007953) [0..]
    -- Reinhard Zumkeller, Jul 17 2014
    
  • Magma
    [n: n in [1..1000] | &+Intseq(n) eq 10 ]; // Vincenzo Librandi, Mar 10 2013
    
  • Maple
    sd := proc (n) options operator, arrow: add(convert(n, base, 10)[j], j = 1 .. nops(convert(n, base, 10))) end proc: a := proc (n) if sd(n) = 10 then n else end if end proc: seq(a(n), n = 1 .. 800); # Emeric Deutsch, Jan 16 2009
  • Mathematica
    Union[Flatten[Table[FromDigits /@ Permutations[PadRight[s, 7]], {s, Rest[IntegerPartitions[10]]}]]] (* T. D. Noe, Mar 08 2013 *)
    Select[Range[1000], Total[IntegerDigits[#]] == 10 &] (* Vincenzo Librandi, Mar 10 2013 *)
  • PARI
    isok(n) = sumdigits(n) == 10; \\ Michel Marcus, Dec 28 2015
    
  • PARI
    \\ This algorithm needs a modified binomial.
    C(n, k)=if(n>=k, binomial(n, k), 0)
    \\ ways to roll s-q with q dice having sides 0 through n - 1.
    b(s, q, n)=if(s<=q*(n-1), s+=q; sum(i=0, q-1, (-1)^i*C(q, i)*C(s-1-n*i, q-1)), 0)
    \\ main algorithm; this program applies to all sequences of the form "Numbers whose sum of digits is m."
    a(n,{m=10}) = {my(q); q = 2; while(b(m, q, 10) < n, q++); q--; s = m; os = m; r=0; while(q, if(b(s, q, 10) < n, n-=b(s, q, 10); s--, r+=(os-s)*10^(q); os = s; q--)); r+= s; r}
    \\ David A. Corneth, Jun 05 2016
    
  • Python
    from sympy.utilities.iterables import multiset_permutations
    def auptodigs(maxdigits, b=10, sod=10): # works for any base, sum-of-digits
        alst = [sod] if 0 <= sod < b else []
        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 range(2, maxdigits + 1):
            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:
                      alst.append(int("".join(map(str, [firstdig]+p)), b))
                      if p[0] == target_sum:
                          break
        return alst
    print(auptodigs(4)) # Michael S. Branicky, Sep 14 2021
    
  • Python
    def A052224(N = 19):
        """Return a generator of the sequence of all integers >= N with the same
        digit sum as N."""
        while True:
            yield N
            N = A228915(N) # skip to next larger integer with the same digit sum
    a = A052224(); [next(a) for  in range(50)] # _M. F. Hasler, Mar 16 2022

Formula

a(n+1) = A228915(a(n)) for any n > 0. - Rémy Sigrist, Jul 10 2018

Extensions

Incorrect formula deleted by N. J. A. Sloane, Jan 15 2009
Extended by Emeric Deutsch, Jan 16 2009
Offset changed by Bruno Berselli, Mar 07 2013

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

A138471 Number of numbers less than n having the same sum of digits.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, 4, 4, 4, 4, 4, 4, 3, 2, 1, 0, 5, 5, 5, 5, 5, 4, 3, 2, 1, 0, 6, 6, 6, 6, 5, 4, 3, 2, 1, 0, 7, 7, 7, 6, 5, 4, 3, 2, 1, 0, 8, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 2, 3, 4, 5, 6
Offset: 0

Views

Author

Reinhard Zumkeller, Mar 19 2008

Keywords

Comments

A138470(n) + a(n) + A138472(n) = n;
a(A051885(n)) = 0.
a(A228915(n)) = a(n)+1. - Robert Israel, May 26 2017

Examples

			a(42)=#{6,15,24,33}=4.
		

Crossrefs

Programs

  • Maple
    N:= 1000: # to get a(0) to a(N)
    C:= Vector(9*(1+ilog10(N))):
    A[0]:= 0:
    for n from 1 to N do
      s:= convert(convert(n,base,10),`+`);
      A[n]:= C[s];
      C[s]:= C[s]+1;
    od:
    seq(A[i],i=0..N); # Robert Israel, May 25 2017
  • Mathematica
    Module[{nn=110,sd},sd=Total[IntegerDigits[#]]&/@Range[nn];Join[{0},Table[ Count[Take[sd,i-1],sd[[i]]],{i,nn}]]] (* Harvey P. Dale, Aug 14 2013 *)
  • PARI
    a(n) = my(sdn=sumdigits(n)); sum(k=1, n-1, sumdigits(k) == sdn); \\ Michel Marcus, May 26 2017

A319021 Next larger integer with same sum of digits in base 3 as n.

Original entry on oeis.org

3, 4, 9, 6, 7, 10, 11, 14, 27, 12, 13, 18, 15, 16, 19, 20, 23, 28, 21, 22, 29, 24, 25, 32, 35, 44, 81, 30, 31, 36, 33, 34, 37, 38, 41, 54, 39, 40, 45, 42, 43, 46, 47, 50, 55, 48, 49, 56, 51, 52, 59, 62, 71, 82, 57, 58, 63, 60, 61, 64, 65, 68, 83, 66, 67, 72
Offset: 1

Views

Author

Rémy Sigrist, Sep 08 2018

Keywords

Comments

This sequence is the base-3 variant of A057168 (base-2) and of A228915 (base-10).
All integers except those in A062318 appear in this sequence.

Examples

			The first terms, alongside the ternary representations of n and of a(n), are:
  n   a(n)  ter(n)  ter(a(n))
  --  ----  ------  ---------
   1     3      1     10
   2     4      2     11
   3     9     10    100
   4     6     11     20
   5     7     12     21
   6    10     20    101
   7    11     21    102
   8    14     22    112
   9    27    100   1000
  10    12    101    110
  11    13    102    111
  12    18    110    200
  13    15    111    120
  14    16    112    121
  15    19    120    201
		

Crossrefs

Programs

  • Mathematica
    nli3[n_]:=Module[{nd3=Total[IntegerDigits[n,3]],k=n+1},While[Total[IntegerDigits[k,3]]!=nd3,k++];k]; Array[nli3,70] (* Harvey P. Dale, Jun 27 2023 *)
  • PARI
    a(n, base=3) = my (c=0); for (w=0, oo, my (d=n % base); if (d+1 < base && c, return ((n+1)*base^w + ((c-1)%(base-1) + 1)*base^((c-1)\(base-1))-1), c += d; n \= base))
    
  • Python
    def a(n, base=3):
        c, b, w = 0, base, 0
        while True:
            d = n%b
            if d+1 < b and c:
                return (n+1)*b**w + ((c-1)%(b-1)+1)*b**((c-1)//(b-1))-1
            c += d; n //= b; w += 1
    print([a(n) for n in range(1, 67)]) # Michael S. Branicky, Jul 10 2022 after Rémy Sigrist

Formula

a(3^k) = 3^(k+1) for any k >= 0.
A053735(a(n)) = A053735(n).

A343604 a(n) is the least number > n with the same sum of balanced ternary digits as n.

Original entry on oeis.org

2, 3, 6, 7, 10, 15, 8, 9, 16, 11, 12, 19, 22, 31, 42, 17, 18, 23, 20, 21, 24, 25, 28, 43, 26, 27, 32, 29, 30, 33, 34, 37, 46, 35, 36, 49, 38, 39, 58, 67, 94, 123, 44, 45, 50, 47, 48, 51, 52, 55, 68, 53, 54, 59, 56, 57, 60, 61, 64, 69, 62, 63, 70, 65, 66, 73
Offset: 0

Views

Author

Rémy Sigrist, Apr 22 2021

Keywords

Comments

This sequence can be extended to negative indexes by setting a(-n) = -A343605(n) for any n > 0.

Examples

			The first terms, in base 10 and in balanced ternary (where T denotes the digit -1), alongside A065363(n), are:
  n   a(n)  bter(n)  bter(a(n))  A065363(n)
  --  ----  -------  ----------  ----------
   0     2        0          1T           0
   1     3        1          10           1
   2     6       1T         1T0           0
   3     7       10         1T1           1
   4    10       11         101           2
   5    15      1TT        1TT0          -1
   6     8      1T0         10T           0
   7     9      1T1         100           1
   8    16      10T        1TT1           0
   9    11      100         11T           1
  10    12      101         110           2
  11    19      11T        1T01           1
  12    22      110        1T11           2
		

Crossrefs

Programs

  • PARI
    A065363(n) = { my (v=0, d); while (n, v+=d=centerlift(Mod(n,3)); n=(n-d)\3); v }
    a(n) = my (s=A065363(n)); for (k=n+1, oo, if (s==A065363(k), return (k)))

Formula

a(9*n) = 9*n + 2.
a(A174658(n)) = A174658(n+1).

A375460 Lexicographically earliest sequence of distinct nonnegative terms arranged in successive chunks whose digitsum = 10.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 10, 11, 20, 6, 12, 100, 7, 21, 8, 101, 9, 1000, 13, 14, 10000, 15, 22, 16, 30, 17, 110, 18, 100000, 19, 23, 31, 1000000, 24, 40, 25, 102, 26, 200, 27, 10000000, 28, 32, 41, 33, 103, 34, 111, 35, 1001, 36, 100000000, 37, 42, 112, 43, 120, 44, 1010, 45, 1000000000
Offset: 1

Views

Author

Eric Angelini, Aug 15 2024

Keywords

Comments

The first integer that will never appear in the sequence is 29, as its digitsum exceeds 10.
From Michael S. Branicky, Aug 16 2024: (Start)
Infinite since A052224 is infinite (as are all sequences with digital sum 1..10).
a(6492) has 1001 digits. (End)

Examples

			The first chunk of integers with digitsum 10 is (0,1,2,3,4);
the next one is (5,10,11,20),
the next one is (6,12,100),
the next one is (7,21),
the next one is (8,101),
the next one is (9,1000),
the next one is (13,14,10000), etc.
The concatenation of the above chunks produce the sequence.
		

Crossrefs

Numbers with digital sum 1..10: A011557 (1), A052216 (2), A052217 (3), A052218 (4), A052219 (5), A052220 (6), A052221 (7), A052222 (8), A052223 (9), A052224 (10).

Programs

  • Python
    from itertools import islice
    def bgen(ds): # generator of terms with digital sum ds
        def A051885(n): return ((n%9)+1)*10**(n//9)-1 # due to Chai Wah Wu
        def A228915(n): # due to M. F. Hasler
            p = r = 0
            while True:
                d = n % 10
                if d < 9 and r: return (n+1)*10**p + A051885(r-1)
                n //= 10; r += d; p += 1
        k = A051885(ds)
        while True: yield k; k = A228915(k)
    def agen(): # generator of terms
        an, ds_block = 0, 0
        dsg = [None] + [bgen(i) for i in range(1, 11)]
        dsi = [None] + [(next(dsg[i]), i) for i in range(1, 11)]
        while True:
            yield an
            an, ds_an = min(dsi[j] for j in range(1, 11-ds_block))
            ds_block = (ds_block + ds_an)%10
            dsi[ds_an] = (next(dsg[ds_an]), ds_an)
    print(list(islice(agen(), 61))) # Michael S. Branicky, Aug 16 2024

Extensions

a(46) and beyond from Michael S. Branicky, Aug 16 2024.

A375967 a(n) is the least number > n with the same digit average as n.

Original entry on oeis.org

11, 13, 15, 17, 19, 39, 59, 79, 99, 1001, 20, 21, 22, 23, 24, 25, 26, 27, 28, 102, 30, 31, 32, 33, 34, 35, 36, 37, 38, 1005, 40, 41, 42, 43, 44, 45, 46, 47, 48, 105, 50, 51, 52, 53, 54, 55, 56, 57, 58, 1009, 60, 61, 62, 63, 64, 65, 66, 67, 68, 108, 70, 71, 72
Offset: 1

Views

Author

Rémy Sigrist, Sep 04 2024

Keywords

Comments

The digit average of a number n is its sum of digits divided by its number of digits: A007953(n) / A055642(n).

Examples

			The first terms, alongside the corresponding digit average, are:
  n   a(n)  Digit average
  --  ----  -------------
   1    11              1
   2    13              2
   3    15              3
   4    17              4
   5    19              5
   6    39              6
   7    59              7
   8    79              8
   9    99              9
  10  1001            1/2
  11    20              1
  12    21            3/2
		

Crossrefs

Programs

  • Mathematica
    a[n_]:=Module[{k=0}, While[k<=n || Mean[IntegerDigits[k]] != Mean[IntegerDigits[n]], k++]; k]; Array[a,63] (* Stefano Spezia, Sep 07 2024 *)
  • PARI
    avg(n, base) = my (d = digits(n, base)); vecsum(d) / max(1, #d)
    a(n, base = 10) = { my (v = avg(n, base)); for (m = n+1, oo, if (avg(m, base)==v, return (m););); }
    
  • PARI
    \\ See Links section.

A287076 a(n) = least k > n with the same sum of digits as n in some base b > 1.

Original entry on oeis.org

2, 4, 5, 6, 6, 9, 10, 12, 10, 12, 13, 16, 14, 16, 19, 20, 18, 20, 21, 22, 22, 24, 25, 30, 26, 28, 29, 30, 30, 36, 33, 34, 34, 36, 37, 40, 38, 40, 42, 42, 42, 44, 45, 48, 46, 48, 49, 56, 50, 52, 53, 56, 54, 57, 57, 58, 58, 60, 61, 64, 62, 66, 67, 66, 66, 68, 69
Offset: 1

Views

Author

Rémy Sigrist, May 19 2017

Keywords

Comments

More formally: a(n) = Min_{b>1} f_b(n), where f_b(n) = least k > n with the same sum of digits as n in base b.
We have the following properties:
- f_b(b) = b^2 for any b > 1,
- f_b(b^k) = b^(k+1) for any b > 1 and k >= 0,
- f_b(n) = b + n - 1 for any b > 1 and n < b,
- f_b(n) - n >= b - 1 for any b > 1 and n > 0.
Also, f_2 = A057168 and f_10 = A228915.
For any n > 0, n < a(n) <= 2*n.
Conjecturally, a(n) ~ n.
The derived sequence e(n) = a(n) - n is unbounded: for any n > 0:
- for any b such that 1 < b <= n, let x_b = the least power of b such that f_b(i*x_b) - i*x_b >= n for any i > 0,
- let X = Lcm_{b=2..n} x_b,
- then f_b(X) - X >= n for any b such that 1 < b <= n,
- also, f_b(X) - X >= b - 1 >= n for any b > n,
- hence a(X) - X = e(X) >= n, QED.

Examples

			The following table shows f_b(8) for all bases b > 1:
b    f_b(8)   8 in base b   f_b(8) in base b
--   ------   -----------   ----------------
2        16        "1000"            "10000"
3        14          "22"              "112"
4        17          "20"              "101"
5        12          "13"               "22"
6        13          "12"               "21"
7        14          "11"               "20"
8        64          "10"              "100"
b>8     b+7           "8"               "17"
Hence, a(8) = f_5(8) = 12.
		

Crossrefs

A375387 a(n) is the least number k whose sum of digits in base 10 is n and that is palindromic in base n, or -1 if no such number exists.

Original entry on oeis.org

-1, 130, 41, 123, 16, 170, -1, 55, 155, 39, 274, 239, 96, 187, 494, 2925, 685, 1784, 1389, 859, 599, 1779, 1978, 989, 6597, 5887, 6968, 8499, 5989, 17969, 29859, 17899, 28898, 435897, 38989, 2089469, 1788960, 498847, 2886278, 487878, 919996, 4098689, 898794, 1896967
Offset: 3

Views

Author

Jean-Marc Rebert, Aug 13 2024

Keywords

Comments

A positive integer that is a multiple of 3 ends with 0 in base 3, so it cannot be a palindrome in base 3.
A positive integer that is a multiple of 9 ends with 0 in base 9, so it cannot be a palindrome in base 9.
From Michael S. Branicky, Aug 15 2024: (Start)
Regarding a(2): To be a palindrome in base 2, it must end with 1, hence odd. To be odd and have digit sum 2 in base 10, it must be of the form t_d = 10^(d-1) + 1, d > 1 (a d-digit base-10 number). t_d is not divisible by 3, and base-2 palindromes with even length (i.e., number of binary digits) are divisible by 3, so, if a(2) exists, it must be a base-2 palindrome with odd length.
Computer search shows no such terms with d <= 10^6, so a(2), if it exists, has > 10^6 decimal digits. (End)

Examples

			a(5) = 41, because 4 + 1 = 5 and 41 = 131_5, and no lesser number has this property.
First terms are:
  130 = 2002_4
  41  = 131_5
  123 = 3323_6
  16  = 22_7
  170 = 252_8
		

Crossrefs

Programs

  • PARI
    isok(k, n) = if (sumdigits(k)==n, my(d=digits(k, n)); d==Vecrev(d));
    a(n) = if ((n==3) || (n==9), return((-1))); my(k=1); while (!isok(k,n), k++); k; \\ Michel Marcus, Aug 13 2024
    
  • Python
    # see Links for faster variants
    from itertools import count
    from sympy.ntheory import is_palindromic
    def a(n):
        if n in {3, 9}: return -1
        return next(k for k in count(10**(n//9)-1) if sum(map(int, str(k)))==n and is_palindromic(k, n))
    print([a(n) for n in range(3, 47)]) # Michael S. Branicky, Aug 13 2024

A375477 Lexicographically earliest sequence of distinct nonnegative terms arranged in successive chunks whose digitsum = 10, said chunks being "linked" (see the Comments section for an explanation).

Original entry on oeis.org

0, 1, 2, 3, 4, 40, 6, 60, 10, 12, 20, 5, 21, 11, 8, 80, 101, 13, 15, 50, 14, 41, 23, 30, 7, 70, 100, 1001, 16, 102, 22, 24, 42, 31, 17, 10001, 19, 91, 103, 33, 32, 104, 43, 111, 105, 110, 100001, 106, 201, 107, 1000001, 109, 901, 112, 51, 113, 120, 10000001, 114, 121
Offset: 1

Views

Author

Keywords

Comments

The 1st chunk with digitsum = 10 is (0, 1, 2, 3, 4), ending with a "4". The next chunk with digitsum = 10 must start with a "4" (this is the "link") and is thus (40, 6). As the next chunk with digitsum = 10 must start with a "6", we have (60, 10, 12). The next chunk with digitsum = 10 must start with a "2" and we have (20, 5, 21), etc.
No chunk is allowed to end with a zero. Thus, no intermediate chunk digit sum can be 9, and anytime a chunk needs a digitsum of 2 to "complete", the next term must be of the form 10^k + 1 for k >= 1.
Infinite since there are an infinity of terms with digits sums <= 10.
a(5367) has 1001 digits.

Crossrefs

Cf. A375460.

Programs

  • Python
    from itertools import count, islice
    def bgen(ds): # generator of terms with digital sum ds
        def A051885(n): return ((n%9)+1)*10**(n//9)-1 # due to Chai Wah Wu
        def A228915(n): # due to M. F. Hasler
            p = r = 0
            while True:
                d = n % 10
                if d < 9 and r: return (n+1)*10**p + A051885(r-1)
                n //= 10; r += d; p += 1
        k = A051885(ds)
        while True: yield k; k = A228915(k)
    def agen(): # generator of terms
        an, ds_block, seen, link_set, min2 = 0, 0, set(), "123456789", 11
        while True:
            yield an
            seen.add(an)
            if ds_block == 8:
                while min2 in seen: min2 = 10*min2 - 9
                an, ds_an, link_an = min2, 2, "1"
            else:
                cand_ds = list(range(1, 9-ds_block)) + [10-ds_block]
                dsg = [0] + [bgen(i) for i in range(1, 11-ds_block)]
                dsi = [0] + [(next(dsg[i]), i) for i in range(1, 11-ds_block)]
                while True:
                    k, ds_k = min(dsi[j] for j in cand_ds)
                    if k not in seen:
                        sk, dst = str(k), ds_k + ds_block
                        if sk[0] in link_set:
                            if dst < 9 or (dst == 10 and k%10 != 0):
                                an, ds_an, link_an = k, ds_k, sk[-1]
                                break
                    dsi[ds_k] = (next(dsg[ds_k]), ds_k)
            ds_block = ds_block + ds_an
            if ds_block == 10: ds_block, link_set = 0, link_an
            else: link_set = "123456789"
    print(list(islice(agen(), 60)))
Showing 1-10 of 11 results. Next