← Back to challenges

Automorphic Number

JavaScriptHardlogicmathnumbersvalidation

Instructions

A number is called Automorphic number if its square ends in the original number. Create a function that takes a number n and returns true if it is an Automorphic number, otherwise false.

Examples

automorphic(1) ➞ true

automorphic(3) ➞ false
// 3^2 = 9

automorphic(6) ➞ true
// 6^2 = 36 (ends with 6)

automorphic(95) ➞ false
// 95^2 = 9025 (does not end with 95)

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: The Forbidden Letter