← All problemsSign in

Magic Number

A positive integer is said to be a magic number if it is equal to the sum of its positive divisors less than itself. Input The only line in the input contains a positive integer N where 1 Output The output is 1 if it’s a magic number else the output is -1 Example Input: 28 Output: 1

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start