A080221 n is Harshad (divisible by the sum of its digits) in a(n) bases from 1 to n.
1, 2, 2, 4, 2, 6, 2, 7, 5, 7, 2, 11, 2, 5, 8, 11, 2, 13, 2, 13, 10, 5, 2, 19, 7, 6, 10, 14, 2, 18, 2, 16, 9, 6, 11, 23, 2, 5, 8, 23, 2, 20, 2, 11, 19, 5, 2, 30, 7, 16, 9, 14, 2, 21, 10, 21, 9, 5, 2, 34, 2, 5, 19, 23, 13, 23, 2, 12, 9, 22, 2, 39, 2, 5, 20, 13, 13, 21, 2, 34, 18, 7, 2, 37, 12, 5
Offset: 1
Examples
6 is represented by the numeral 111111 in unary, 110 in binary, 20 in base 3, 12 in base 4, 11 in base 5 and 10 in base 6. The sums of the digits are 6, 2, 2, 3, 2 and 1 respectively, all divisors of 6; therefore a(6)=6.
References
- Eric W. Weisstein, CRC Concise Encyclopedia of Mathematics, Second ed., Chapman & Hall/CRC, 2003, p. 1310.
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
nivenQ[n_, b_] := Divisible[n, Total @ IntegerDigits[n, b]]; a[n_] := 1 + Sum[Boole @ nivenQ[n, b], {b, 2, n}]; Array[a, 100] (* Amiram Eldar, Jan 01 2020 *)
-
Python
from sympy.ntheory.factor_ import digits def A080221(n): return n-sum(1 for b in range(2,n) if n%sum(digits(n,b)[1:])) # Chai Wah Wu, Oct 19 2022
Extensions
More terms from John W. Layman, Nov 10 2004
Comments