Am I an Automorphic Number?
Python 2, 24 bytes
lambda n:`n*1L`in`n**2L`
Try it online!
For the first time in history, Python 2's appending an L
to the repr of longs is a feature rather than a bug.
The idea is to check if say, 76^2=5776
ends in 76
by checking if 76L
is a substring of 5776L
. To make the L
appear for non-huge numbers, we multiply by 1L
or have 2L
as the exponent, since an arithmetic operation with a long with produces a long.
Brachylog, 5 bytes
~√a₁?
Try it online!
How it works
~√a₁?
~√ the input is the square root of a number
a₁ whose suffix is
? the input
Python 2, 31 bytes
Out-golfed by xnor... (this happens every single time) >< But hey, it's surprisingly Pythonic for code-golf.
People don't tend to remember Python has str.endswith()
...
lambda n:str(n*n).endswith(`n`)
Try it online!