You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
Editor's Note: This file was selected as MATLAB Central Pick of the Week
The Same Rule, Different Fates
At the start of the year, people often ask simple questions. Is this year going to be lucky? Will it turn out well? That’s how I stumbled (again) on a small numerical curiosity called happy numbers.
The rules are almost trivial.
- Take a number.
- Split it into digits.
- Square them.
- Add them up.
- Repeat
That’s it. No clever tricks. No advanced maths. Just iteration. And yet - something interesting happens. Some numbers quietly settle down. They converge to 1 and stop changing. These numbers are called happy.
Others never do.
They fall into a loop and keep cycling forever.
Same rule, different fates.
Cite As
Martin Foltin (2026). Happy Numbers (https://uk.mathworks.com/matlabcentral/fileexchange/182984-happy-numbers), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.0.2 (376 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
