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.

  1. Calculate the square of target.
  2. Determine how many digits are in the original target.
  3. Extract the last n digits of the square using a loop or modulo.
  4. Print "true" if they match, otherwise "false".

01EXAMPLE 1

Inputtarget = 25
Outputtrue

Explanation: 625 ends in 25.

Constraints

  • Extract digits mathematically.
  • Handle variable digit counts.
MathLoopsDigits
JavaScript
Loading...
3 Hidden

Input Arguments

target25

Expected Output

true

Click RUN to test your solution