Skip to content

HappyNumbers ​

The happy numbers 1,7,10,13,19,…1, 7, 10, 13, 19, …: iterating sum-of-squared-digits reaches 1.

HappyNumbersthe nn whose sum-of-squared-digits iteration reaches 1 (rather than the other cycle, {4,16,37,58,89,145,42,20}\{4,16,37,58,89,145,42,20\}), an infinite indexed collection.

Domain: Collections

Details
  • A lazy indexed collection: Count(HappyNumbers)=+∞Count(HappyNumbers) = +\infty. OEIS A007770.
  • At(HappyNumbers,k)At(HappyNumbers, k) unranks by scanning forward from the last cached match -- At(HappyNumbers,5)=19At(HappyNumbers, 5) = 19.
  • Membership goes through Element: Element(7,HappyNumbers)Element(7, HappyNumbers) is true (7→49→97→130→10→17 \to 49 \to 97 \to 130 \to 10 \to 1), Element(4,HappyNumbers)Element(4, HappyNumbers) is false (the other cycle).

Enumeration

Examples

1 more kept as data, checked against the oracles
About
Examples1
CrosswalkOEIS

See also: Count, At, Element, HarshadNumbers