Exercises/#77 Happy Number
#77

Happy Number

EasyπŸ”’ Math & Numbers
50 XP

Problem

A happy number: repeatedly replace it with the sum of squares of its digits. If it reaches 1, it's happy. Detect cycles to identify unhappy numbers.

Examples

Input: n=19
Output: true (19β†’82β†’68β†’100β†’1)

Input: n=2
Output: false
mathhash-setfloyd
AI Assistantβ€” powered by AI

Unlock hints progressively β€” start gentle, go deeper only if needed.

πŸ’‘

Level 1: Gentle Nudge

A subtle direction

πŸ—ΊοΈ

Level 2: Approach

The algorithm to use

πŸ”

Level 3: Detailed

Step-by-step guidance

77 / 150

Your Solution

⚑ JavaScript

to save progress and use AI features