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

A217973 Niven (or Harshad) numbers not containing the digit 0.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 18, 21, 24, 27, 36, 42, 45, 48, 54, 63, 72, 81, 84, 111, 112, 114, 117, 126, 132, 133, 135, 144, 152, 153, 156, 162, 171, 192, 195, 198, 216, 222, 224, 225, 228, 234, 243, 247, 252, 261, 264, 266, 285, 288, 312, 315, 322, 324, 333, 336
Offset: 1

Views

Author

Keywords

Comments

Andreescu & Andrica prove that this sequence is infinite.
For each positive integer n, there exists a n-digit Niven (or Harshad) number not containing the digit 0 (see A348318 for more explanations and links). - Bernard Schott, Oct 20 2021

References

  • Titu Andreescu and Dorin Andrica, Number Theory, Structures, Examples, and Problems, Problem 5.2.3 on pages 109-110.

Crossrefs

Intersection of A005349 and A052382.
A216405 is a subsequence.

Programs

  • Maple
    filter:= proc(n) local L;
    L:= convert(n,base,10);
    not has(L,0) and n mod convert(L,`+`) = 0
    end proc:
    select(filter, [$1..1000]); # Robert Israel, Apr 01 2016
  • Mathematica
    Select[Range[400], IntegerQ[ #/(Plus @@ IntegerDigits[#])] && DigitCount[#, 10, 0] == 0 &]  (* Alonso del Arte, Oct 16 2012 *)
  • PARI
    is(n)=vecsort(digits(n))[1]&&n%sumdigits(n)==0
    
  • Python
    def ok(n): s = str(n); return '0' not in s and n%sum(map(int, s)) == 0
    print([k for k in range(337) if ok(k)]) # Michael S. Branicky, Oct 20 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
Showing 1-2 of 2 results.