Skip to content

๐Ÿงฎ My learning version of the Happy Numbers problem โ€“ step by step from manual logic to working code ๐Ÿ’ก

Notifications You must be signed in to change notification settings

moroniq/happy_numbers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ˜Š Happy Numbers โ€“ Learning Journey

This notebook shows my step-by-step process of understanding the Happy Numbers problem in Python.

๐Ÿงฉ A happy number is a number that eventually reaches 1 when repeatedly replaced by the sum of the squares of its digits.

๐Ÿง  What this notebook includes:

manual breakdown of the process (my first approach)

early experiments with strings and digit extraction

final working loop version using a while loop and a set to track visited numbers

๐Ÿ’ก Example output:

n = 19  โ†’ 82 โ†’ 68 โ†’ 100 โ†’ 1
Your number is happy ๐ŸŽ‰

n = 113 โ†’ ... โ†’ 4 โ†’ 16 โ†’ 37 โ†’ ... (cycle)
Your number is unhappy ๐Ÿ˜”


๐Ÿš€ Concepts practiced:

working with while loops
iterating through digits
using sets to detect cycles
building logic step by step

๐Ÿงญ This version is intentionally imperfect โ€” it shows the way I think through problems, not just the final code.

About

๐Ÿงฎ My learning version of the Happy Numbers problem โ€“ step by step from manual logic to working code ๐Ÿ’ก

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published