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 51-60 of 61 results. Next

A199190 Least integer having a larger digital sum than the previous term and such that 10^(n-1) + a(n) is a prime.

Original entry on oeis.org

1, 3, 7, 9, 37, 49, 99, 379, 399, 787, 799, 1989, 1999, 3999, 6997, 17899, 18999, 38989, 67999, 79899, 79999, 389899, 499989, 798979, 897999, 989899, 2999997, 2899999, 4998999
Offset: 1

Views

Author

M. F. Hasler, Nov 03 2011

Keywords

Comments

Equivalent to A199124, but contains the same information in more condensed form.

Crossrefs

Cf. A051885.

Programs

A205960 Smallest odd number with digit sum equal to n.

Original entry on oeis.org

1, 11, 3, 13, 5, 15, 7, 17, 9, 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, 499999
Offset: 1

Views

Author

Arkadiusz Wesolowski, Feb 02 2012

Keywords

Comments

Except for a(2), a(4), a(6) and a(8), the same as A051885 (n>0).

Crossrefs

Programs

  • Mathematica
    e = 5; Join[Table[l = 1; While[True, a = 2*l - 1; If[Total[IntegerDigits[a]] == n, Break[]]; l++]; a, {n, 8}], Flatten[Table[i*10^j - 1, {j, e}, {i, 9}]]]
    With[{ds=Table[{n,Total[IntegerDigits[n]]},{n,1,600001,2}]},Table[ SelectFirst[ ds,#[[2]]==k&],{k,50}]][[All,1]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Apr 30 2018 *)

Formula

a(n+1) = A069532(n) + 1.
From Chai Wah Wu, Sep 15 2020: (Start)
a(n) = a(n-1) + 10*a(n-9) - 10*a(n-10) for n > 18.
G.f.: x*(90*x^17 - 90*x^16 + 90*x^15 - 90*x^14 + 90*x^13 - 90*x^12 + 90*x^11 - 90*x^10 - 8*x^8 + 10*x^7 - 8*x^6 + 10*x^5 - 8*x^4 + 10*x^3 - 8*x^2 + 10*x + 1)/((x - 1)*(10*x^9 - 1)). (End)

A263019 If n is the i-th positive integer with digital sum j, then a(n) is the j-th positive integer with digital sum i.

Original entry on oeis.org

1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 2, 11, 20, 101, 110, 200, 1001, 1010, 1100, 1000000000, 12, 21, 30, 102, 111, 120, 201, 210, 2000, 10000000000, 22, 31, 40, 103, 112, 121, 130, 300, 10001, 100000000000, 32, 41, 50, 104, 113, 122
Offset: 1

Views

Author

Paul Tek, Oct 07 2015

Keywords

Comments

Digital sum is given by A007953.
This is a self-inverse permutation of the natural numbers, with fixed points A081927.
A007953(n) = A081927(a(n)) for any n>0.
A081927(n) = A007953(a(n)) for any n>0.
a(A051885(n)) = 10^(n-1) for any n>0.
a(10^(n-1)) = A051885(n) for any n>0.

Crossrefs

Programs

  • PARI
    a(n) = {j = sumdigits(n); v = vector(n, k, sumdigits(k)); i = #select(x->x==j, v); nb = 0; k = 0; while(nb != j, k++; if (sumdigits(k) == i, nb++)); k;} \\ Michel Marcus, Oct 16 2015

A305493 A binary encoding of the decimal representation of a number: for any number n >= 0, consider its decimal representation and replace each 9 with "111111111" and each other digit d with a "0" followed by d "1"s and interpret the result as a binary string.

Original entry on oeis.org

0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 2, 5, 11, 23, 47, 95, 191, 383, 767, 1023, 6, 13, 27, 55, 111, 223, 447, 895, 1791, 2047, 14, 29, 59, 119, 239, 479, 959, 1919, 3839, 4095, 30, 61, 123, 247, 495, 991, 1983, 3967, 7935, 8191, 62, 125, 251, 503, 1007, 2015
Offset: 0

Views

Author

Rémy Sigrist, Jun 02 2018

Keywords

Comments

This sequence is a permutation of the nonnegative numbers.
The inverse sequence, say b, satisfies b(n) = A001202(n+1) for n = 0..1022, but b(1023) = 19 whereas A001202(1024) = 10.
The first known fixed points are: 0, 1, 65010; they all belong to A037308.
This encoding can be applied to any base b > 1 (when b = 2, we obtain the identity function) as well as to the factorial base and to the primorial base.

Examples

			For n = 1972:
- the digit 1 is replaced by "01",
- the digit 9 is replaced by "111111111",
- the digit 7 is replaced by "01111111",
- the digit 2 is replaced by "011",
- hence we obtain the binary string "0111111111101111111011",
- and a(1972) = 2096123.
		

Crossrefs

Programs

  • Mathematica
    tb=Table[n->PadRight[{0},n+1,1],{n,9}]/.PadRight[{0},10,1]-> PadRight[ {},9,1]; Table[FromDigits[IntegerDigits[n]/.tb//Flatten,2],{n,0,60}] (* Harvey P. Dale, Jul 31 2018 *)
  • PARI
    a(n, base=10) = my (b=[], d=digits(n, base)); for (i=1, #d, if (d[i]!=base-1, b=concat(b, 0)); b=concat(b, vector(d[i], k, 1))); fromdigits(b, 2)
    /* inverse */ b(n, base=10) = my (v=0, p=1); while (n, my (d = min(valuation(n+1, 2), base-1)); v += p * d; n \= 2^min(base-1, 1+d); p *= base); v

Formula

A000120(a(n)) = A007953(n).
a(A051885(k)) = 2^k - 1 for any k >= 0.
a(A002275(k)) = A002450(k) for any k >= 0.
a(10 * n) = 2 * a(n).

A359003 a(n) is the smallest n-gonal number whose sum of digits is n.

Original entry on oeis.org

3, 4, 5, 6, 7, 8, 9, 370, 506, 156, 238, 671, 726, 88, 836, 585, 775, 7337, 5268, 8149, 8555, 8961, 9367, 9773, 15786, 9856, 91964, 65757, 89428, 179960, 47796, 108979, 197945, 86976, 467974, 998516, 259896, 598792, 1737788, 869649, 969991, 1985984, 998676, 3798496, 7979546, 5877696
Offset: 3

Views

Author

Ilya Gutkovskiy, Dec 10 2022

Keywords

Examples

			370 is the smallest 10-gonal number with digit sum 10, so a(10) = 370.
		

Crossrefs

Programs

  • Mathematica
    p[n_, k_] := (n - 2)*k*(k - 1)/2 + k; a[n_] := Module[{k = 1, pk}, While[Plus @@ IntegerDigits[pk = p[n, k]] != n, k++]; pk]; Array[a, 45, 3] (* Amiram Eldar, Dec 10 2022 *)

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

A378119 a(n) is the smallest positive k such that the digit sums of k and k + 1 are both divisible by n, or -1 if no such pair exists.

Original entry on oeis.org

1, 19, -1, 39, 49999, -1, 69999, 79, -1, 18999999999, 2899999, -1, 48999, 5899999999999, -1, 78999999999, 8899, -1, 19899999999999999999, 298999999999, -1, 49899999, 598999999999999999999, -1, 79899999999999999, 898999, -1, 19989999999999999999999999999, 29989999999999999, -1
Offset: 1

Views

Author

Barney Maunder-Taylor, Nov 16 2024

Keywords

Comments

It is clear that a(n) must be -1 if n is a multiple of three since if we assume (hoping for a contradiction) that there exist k, k+1 both of which have digit sums that are multiples of 3, then k and k+1 must themselves both be divisible by 3, a contradiction.

Examples

			a(2) = 19 because both 19 and 20 have digit sums that are multiples of 2: 1+9 = 10 = 5*2 and 2+0 = 2 = 1*2, it is easily checked (by exhaustion) that there is no smaller pair of consecutive integers with this property.
		

Crossrefs

Programs

  • Python
    def A378119(n):
        if n == 1:
            return 1
        elif n % 3 == 0:
            return -1
        else:
            return (((n%9)+1)*10**(n//9)-1)*(10**pow(9,-1,n))-1
    # Colin Beveridge, Dec 13 2024

Formula

a(n) = A051885(n) * 10^q - 1, where q is 9^(-1) (mod n) for n > 1 and n not a multiple of 3 (see linked proof). - Colin Beveridge, Dec 16 2024

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

A129990 Primes p such that the smallest integer whose sum of decimal digits is p is prime.

Original entry on oeis.org

2, 3, 5, 7, 11, 17, 19, 23, 29, 31, 41, 43, 71, 79, 97, 173, 179, 257, 269, 311, 389, 691, 4957, 8423, 11801, 14621, 25621, 26951, 38993, 75743, 102031, 191671, 668869
Offset: 1

Views

Author

J. M. Bergot, Jun 14 2007

Keywords

Examples

			The smallest integer whose sum of digits is 17 is 89; 89 is prime, therefore 17 is in the sequence.
		

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[1000]],PrimeQ[FromDigits[Join[{Mod[ #,9]},Table[9,{i,1,Floor[ #/9]}]]]] &]
  • Python
    from itertools import islice
    from sympy import isprime, nextprime
    def A051885(n): return ((n%9)+1)*10**(n//9)-1 # from Chai Wah Wu
    def agen(startp=2):
        p = startp
        while True:
            if isprime(A051885(p)): yield p
            p = nextprime(p)
    print(list(islice(agen(), 23))) # Michael S. Branicky, Jul 27 2022
    
  • Sage
    sorted( filter(is_prime, sum(([9*t+k for t in oeis(seq).first_terms()] for seq,k in (('A002957',1), ('A056703',2), ('A056712',4), ('A056716',5), ('A056721',7), ('A056725',8))), [3])) ) # Max Alekseyev, Feb 05 2025

Formula

Primes p such that (p mod 9 + 1) * 10^[p/9] - 1 is prime. Therefore the sequence consists of the term 3 and the primes of the forms A002957(k)*9+1, A056703(k)*9+2, A056712(k)*9+4, A056716(k)*9+5, A056721(k)*9+7, A056725(k)*9+8. - Max Alekseyev, Nov 09 2009

Extensions

Edited, corrected and extended by Stefan Steinerberger, Jun 23 2007
Extended by D. S. McNeil, Mar 20 2009
a(29)-a(33) from Max Alekseyev, Nov 09 2009
Previous Showing 51-60 of 61 results. Next