Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Because
2 ** 2 % 8 == 4
. But it should be0
.guys... there are no spoiler flags here...
Here is some explanations regarding the equation you mention: https://math.stackexchange.com/questions/192720/automorphic-numbers
Thanks!
I like your approach; it's much more Pythonic, scaleable, and elegant also - for me, I used this kata as an opportunity to learn about these numbers, so my approach is basically just a copy of my "reading notes" as I worked through the various articles/web pages!
This problem has two attractors
f
ands
for each magnitude of ten10 ** k
They are defined as follows:
f, s = f**2 % 10**k, (1 - (s-1)**2) % 10 ** k
(a) (b)They are also linked together with a simpler formula:
10 ** k = f + s - 1
(2)So you need to calculate only the simpler attractor with (a) and compute the other with (2) before adding them to the solution set