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-5 of 5 results.

A348150 a(n) is the smallest Niven (or Harshad) number with exactly n digits and not containing the digit 0.

Original entry on oeis.org

1, 12, 111, 1116, 11112, 111114, 1111112, 11111112, 111111111, 1111111125, 11111111112, 111111111126, 1111111111116, 11111111111114, 111111111111114, 1111111111111122, 11111111111111112, 111111111111111132, 1111111111111111119, 11111111111111111121, 111111111111111111117
Offset: 1

Views

Author

Bernard Schott, Oct 03 2021

Keywords

Comments

This sequence is inspired by a problem, proposed by Argentina during the 39th International Mathematical Olympiad in 1998 at Taipei, Taiwan, but not used for the competition.
The problem asked for a proof that, for each positive integer n, there exists a n-digit number, not containing the digit 0 and that is divisible by the sum of its digits (see links: Diophante in French and Kalva in English).
This sequence lists the smallest such n-digit integer.

Examples

			111114 has 6 digits, does not contain 0 and is divisible by 1+1+1+1+1+4 = 9 (111114 = 9*12346), while 111111, 111112, 111113 are not respectively divisible by sum of their digits: 6, 7, 8; hence, a(6) = 111114.
		

Crossrefs

Programs

  • Mathematica
    hQ[n_] := ! MemberQ[(d = IntegerDigits[n]), 0] && Divisible[n, Plus @@ d]; a[n_] := Module[{k = (10^n - 1)/9}, While[! hQ[k], k++]; k]; Array[a, 30] (* Amiram Eldar, Oct 03 2021 *)
  • PARI
    a(n) = for(k=(10^n-1)/9, 10^n-1, if (vecmin(digits(k)) && !(k % sumdigits(k)), return (k)));  \\ Michel Marcus, Oct 03 2021
    
  • Python
    def niven(n):
        s = str(n)
        return '0' not in s and n%sum(map(int, s)) == 0
    def a(n):
        k = int("1"*n)
        while not niven(k): k += 1
        return k
    print([a(n) for n in range(1, 22)]) # Michael S. Branicky, Oct 09 2021

Formula

a(n) = A002275(n) = R_n iff n is in A014950.

Extensions

More terms from Amiram Eldar, Oct 03 2021

A348317 a(n) = A348150(n) - A002275(n) where A002275(n) = R_n is the repunit with n times digit 1.

Original entry on oeis.org

0, 1, 0, 5, 1, 3, 1, 1, 0, 14, 1, 15, 5, 3, 3, 11, 1, 21, 8, 10, 6, 5, 1, 3, 2, 12, 0, 17, 25, 14, 5, 13, 6, 74, 1, 54, 41, 12, 8, 14, 4, 105, 41, 55, 63, 33, 25, 13, 5, 103, 3, 33, 40, 63, 3, 52, 15, 23, 40, 21, 20, 10, 21, 11, 25, 33, 41, 47, 45, 14, 1, 171
Offset: 1

Views

Author

Bernard Schott, Oct 12 2021

Keywords

Comments

a(n) measures the gap between the smallest n-digit number not containing the digit 0 and the smallest n-digit Niven number not containing the digit 0.
For more informations and links, see A348150.
a(n) = 0 iff n is in A014950.

Examples

			A348150(4) = 1116 since it is the smallest 4-digit integer not containing the digit 0 that is divisible by the sum of its digits:1116 = (1+1+1+6) * 124;  A002275(4) = R_4 = 1111, hence a(4) = 1116 - 1111 = 5.
		

Crossrefs

Programs

  • Mathematica
    hQ[n_] := ! MemberQ[(d = IntegerDigits[n]), 0] && Divisible[n, Plus @@ d]; a[n_] := Module[{m= (10^n - 1)/9,k=0}, While[! hQ[m+k], k++]; k]; Array[a, 30] (* Amiram Eldar, Oct 13 2021 *)
  • PARI
    a(n) = my(r=(10^n-1)/9); for(k=r, 10^n-1, if (vecmin(digits(k)) && !(k % sumdigits(k)), return (k-r))); \\ Michel Marcus, Oct 13 2021
  • Python
    def a(n):
        s, k = "1"*n, int("1"*n)
        while '0' in s or k%sum(map(int, s)): k += 1; s = str(k)
        return k - int("1"*n)
    print([a(n) for n in range(1, 73)]) # Michael S. Branicky, Oct 12 2021
    

Formula

a(n) = A348150(n) - A002275(n).

Extensions

a(23) and beyond from Michael S. Branicky, Oct 12 2021

A348316 a(n) is the largest Niven (or Harshad) number with exactly n digits and not containing the digit 0.

Original entry on oeis.org

9, 84, 999, 9963, 99972, 999984, 9999966, 99999966, 999999999, 9999999828, 99999999898, 999999999853, 9999999999936, 99999999999783, 999999999999984, 9999999999999858, 99999999999999939, 999999999999999831, 9999999999999999951, 99999999999999999922, 999999999999999999687
Offset: 1

Views

Author

Bernard Schott, Oct 11 2021

Keywords

Comments

This sequence is inspired by a problem, proposed by Argentina during the 39th International Mathematical Olympiad in 1998 at Taipei, Taiwan, but not used for the competition.
The problem asked for a proof that, for each positive integer n, there exists a n-digit number, not containing the digit 0 and that is divisible by the sum of its digits (see links: Diophante in French and Kalva in English).
This sequence lists the largest such n-digit integer.

Examples

			9963 has 4 digits, does not contain 0 and is divisible by 9+9+6+3 = 27 (9963 = 27*369), while there is no integer k with 9964 <= k <= 9999 that is divisible by sum of its digits, hence a(4) = 9963.
		

Crossrefs

Programs

  • Mathematica
    hQ[n_] := ! MemberQ[(d = IntegerDigits[n]), 0] && Divisible[n, Plus @@ d]; a[n_] := Module[{k = 10^n}, While[! hQ[k], k--]; k]; Array[a, 20] (* Amiram Eldar, Oct 11 2021 *)
  • Python
    def a(n):
        s, k = "9"*n, int("9"*n)
        while '0' in s or k%sum(map(int, s)): k -= 1; s = str(k)
        return k
    print([a(n) for n in range(1, 22)]) # Michael S. Branicky, Oct 11 2021

Formula

a(n) = A002283(n) = 10^n - 1 iff n is in A014950 (compare with A348150 formula).

Extensions

More terms from Amiram Eldar, Oct 11 2021

A348318 Number of n-digit Niven (or Harshad) numbers not containing the digit 0.

Original entry on oeis.org

9, 14, 108, 710, 4978, 35724, 273032, 2097356, 16674554, 135091242, 1112325268, 9296413365, 77991481271, 654495034497, 5420117473932
Offset: 1

Views

Author

Bernard Schott, Oct 17 2021

Keywords

Comments

This sequence comes from a problem, proposed by Argentina during the 39th International Mathematical Olympiad in 1998 at Taipei, Taiwan, but not used for the competition. This problem asked for a proof that, for each positive integer n, there exists an n-digit number, not containing the digit 0 and that is divisible by the sum of its digits (see links: Diophante in French and Scholes in English).
This sequence gives the number of such n-digit Niven numbers not containing the digit 0.

Examples

			a(2) = 14 because there are 14 integers {12, 18, 21, 24, 27, 36, 42, 45, 48, 54, 63, 72, 81, 84} in the set of Niven numbers with 2 digits and not containing the digit 0.
		

Crossrefs

Programs

  • Mathematica
    q[n_] := ! MemberQ[(d = IntegerDigits[n]), 0] && Divisible[n, Plus @@ d]; a[n_] := Module[{c = 0, k = (10^n - 1)/9}, While[k < 10^n, If[q[k], c++]; k++]; c]; Array[a, 6] (* Amiram Eldar, Oct 17 2021 *)
  • Python
    from itertools import product
    def a(n): return sum(1 for p in product("123456789", repeat=n) if int("".join(p))%sum(map(int, p)) == 0)
    print([a(n) for n in range(1, 8)]) # Michael S. Branicky, Oct 17 2021

Extensions

a(6)-a(10) from Amiram Eldar, Oct 17 2021
a(11)-a(15) from Martin Ehrenstein, Oct 22 2021

A216405 Numbers which start a run of nine consecutive zero-digit-free decimal integers, each of which is divisible by the sum of its digits.

Original entry on oeis.org

1, 142813628717821, 253323932621811, 1234954171531131, 1713763544613181, 3713154346661821, 5953112416611411, 8711631351783421, 11853531183574141, 12191214257422251, 17137635446131261, 19941476493818971, 21342541323383331, 25628491758925521, 28665872459864731
Offset: 1

Views

Author

Jack Brennen, Oct 16 2012

Keywords

Comments

Each term of the sequence ends with the digit 1.
No run of ten consecutive zero-digit-free decimal integers is possible.

Examples

			The numbers from a(2)=142813628717821 to 142813628717829 are each divisible by their digit sums, which are 61 to 69 respectively.
		

Crossrefs

Subsequence of A217973 and of A017281.

Programs

  • PARI
    \\ Algorithm from Jack Brennen
    list(lim)=my(v=List([1]),m); forstep(d=11, (40320*lim)^(1/9), 10, m=lcm(vector(9,k,d+k-1)); forstep(x=m+d, lim, m, if(sumdigits(x)==d && vecsort(digits(x))[1], listput(v,x)))); vecsort(Vec(v)) \\ Charles R Greathouse IV, Oct 16 2012
Showing 1-5 of 5 results.