# Happy Primes

A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number either equals 1 (where it will stay), or it loops endlessly in a cycle that does not include 1. Those numbers for which this process ends in 1 are happy numbers, while those that do not end in 1 are unhappy numbers (or sad numbers).

More formally, given a number n=n_{0}, define a sequence n_{1}, n_{2}, ... where n_{i+1} is the sum of the squares of the digits of n_{i}. Then n is happy if and only if there exists i such that n_{i}=1.

If a number is happy, then all members of its sequence are happy; if a number is unhappy, all members of the sequence are unhappy.

For example, 19 is happy, as the associated sequence is:

- 1
^{2}+ 9^{2}= 82 - 8
^{2}+ 2^{2}= 68 - 6
^{2}+ 8^{2}= 100 - 1
^{2}+ 0^{2}+ 0^{2}= 1.

First 20: 7, 13, 19, 23, 31, 79, 97, 103, 109, 139, 167, 193, 239, 263, 293, 313, 331, 367, 379, 383

Checkout list of first: 10, 50, 100, 500, 1000 happy primes. You can also check all happy primes.

## Visualization#

Every frame counter is increased by one. If it is happy prime then dot appears. Color has no meaning. Video has 25fps.

You can also compare it with other types.

## External#

- OEIS: A035497
- Wikipedia: Happy Numbers
- Youtube: Visualization up to 1 million

## Tags#

## Related Articles#

- Palindromic Primes
- Right-truncatable primes
- Restricted Left-truncatable primes
- Emirps
- Dihedral Primes
- Left-truncatable primes
- Long Primes
- Two sided primes
- Weakly Primes
- Restricted Right-truncatable primes
- Prime Sextuplets
- Prime Quintuplets 2
- Prime Triplets
- Prime Quintuplets 1
- Proth Primes
- Pythagorean Primes
- Quartan Primes
- Prime Quadruplets
- Prime numbers
- Additive and Multiplicative Primes
- Safe Primes
- Sexy prime quadruplets
- Pierpont Primes
- Sexy primes
- Solinas Primes
- Sophie Germain Primes
- Super Primes
- Thabit primes of the 2nd kind
- Thabit Primes
- Twin primes
- Ulam Primes
- Wagstaff Primes
- Wedderburn-Etherington Primes
- Wilson Primes
- Sexy prime triplets
- Multiplicative Primes
- Pierpont Primes Of the 2nd kind
- Double Mersenne Primes
- Bell Primes
- Carol Primes
- Centered Decagonal Primes
- Centered Heptagonal Primes
- Centered Square Primes
- Centered Triangular Primes
- Chen Primes
- Class 1+ Primes
- Cousin primes
- Cuban Primes 1
- Cuban Primes 2
- Cullen Primes
- Euclid Primes
- Additive Primes
- Factorial Primes
- Fermat Primes
- Fibonacci Primes
- Genocchi Primes
- Good Primes
- Harmonic Primes
- Isolated Primes
- Kynea Primes
- Leyland Primes
- Lucas Primes
- Lucky Primes
- Mersenne Primes
- Mills Primes
- Woodall Primes