2026 is a provably Happy New Year
Every new year, I like to see what makes this year's number interesting. For 2026, I got an easy first hit since it turns out that 2026 is an example of a Happy Number.
According to the Wikipedia page, "A happy number is a number which eventually reaches 1 when the number is replaced by the sum of the square of each digit." Here's a demonstration that 2026 is happy
2026 → 2² + 0² + 2² + 6² = 44
44 → 4² + 4² = 32
32 → 3² + 2² = 13
13 → 1² + 3² = 10
10 → 1² + 0² = 1
All integers are either happy or unhappy and the next happy new year will be in 2030! For further details, check out the Live Script written by Martin that forms today's pick of the week. You can download it from File Exchange or open it directly in MATLAB Online.
Happy New Year!

- 类别:
- Fun,
- Live Script,
- Picks


评论
要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。