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.

A360074 a(n) is the greatest divisor of n divisible by the sum of its own digits.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 12, 1, 7, 5, 8, 1, 18, 1, 20, 21, 2, 1, 24, 5, 2, 27, 7, 1, 30, 1, 8, 3, 2, 7, 36, 1, 2, 3, 40, 1, 42, 1, 4, 45, 2, 1, 48, 7, 50, 3, 4, 1, 54, 5, 8, 3, 2, 1, 60, 1, 2, 63, 8, 5, 6, 1, 4, 3, 70, 1, 72, 1, 2, 5, 4, 7, 6, 1, 80
Offset: 1

Views

Author

Rémy Sigrist, Jan 24 2023

Keywords

Comments

Numbers divisible by the sum of their digits are called Niven (or Harshad, or harshad) numbers (A007602).

Examples

			For n = 32:
- the divisors of 32 are 1, 2, 4, 8, 16 and 32,
- 8 is divisible by 8 whereas 16 is not divisible by 1+6 and 32 is not divisible by 3+2,
- so a(32) = 8.
		

Crossrefs

Programs

  • Mathematica
    Table[Max[Select[Divisors[n],Mod[#,Total[IntegerDigits[#]]]==0&]],{n,80}] (* Harvey P. Dale, Sep 04 2023 *)
  • PARI
    a(n) = fordiv (n, d, my (t=n/d); if (t%sumdigits(t)==0, return (t)))

Formula

a(n) = n iff n belongs to A005349.