The Automorphic Aura
MediumAcc. 91.1%
+25 XP 10
The Self-Contained Square
An Automorphic Number is a number whose square "ends" with the same digits as the number itself. Example: $25^2 = 625$ (ends in 25). $6^2 = 36$ (ends in 6).
The Assignment
Your function receives a parameter target.
- Calculate the square of
target. - Determine how many digits are in the original
target. - Extract the last
ndigits of thesquareusing a loop or modulo. - Print "true" if they match, otherwise "false".
01EXAMPLE 1
Input
target = 25Output
trueExplanation: 625 ends in 25.
Constraints
- Extract digits mathematically.
- Handle variable digit counts.
MathLoopsDigits
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
target25
Expected Output
true
Click RUN to test your solution