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.

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