DEV Community

Discussion on: Daily Challenge #183 - Automorphic Numbers

Collapse
 
emrivero profile image
Emilio Martínez Rivero

Javascript

const automorphic = n => ((n ** 2) - n) % 10 === 0
Collapse
 
craigmc08 profile image
Craig McIlwrath

This doesn't work. For 11, (11² - 11) % 10 = (121 - 11) % 10 = 110 % 10 = 0. Your function would return true, but 11 is not automorphic.