Ad
  • Custom User Avatar

    I had a headslap moment right after posting, my apologies.

  • Custom User Avatar

    Because 2 ** 2 % 8 == 4. But it should be 0.

  • Custom User Avatar

    Why should testing f(8) return 4 instead of 2?

  • Custom User Avatar

    I'm sorry, for clarity, are my equations the problem? They are not a solution that worked for me, simply an approach I tried before finding one that did. However, if that is the issue I will mark it.

    Thanks for letting me know.

  • Custom User Avatar

    guys... there are no spoiler flags here...

  • Custom User Avatar

    Thank you again for taking the time to share these resources with me, I am finishing my BaS in Secure Software Development, and the focus on security methodologies, development lifecycles, and all the fun stuff associated with that path has me polishing my own discrete mathmatics skills and I'm working through the open MIT pre-req's right now. I'm always amazed at how interesting math is when approached correctly versus the embarrasment that was my primary school days.

    Best of luck and I hope I see you around the boards.

  • Default User Avatar

    Here is some explanations regarding the equation you mention: https://math.stackexchange.com/questions/192720/automorphic-numbers

  • Custom User Avatar

    Fantastic explanation!

    Thank you for taking the time to explain that as well as to introduce me to the concept of attractors, I actually tried a multithreaded approach with itterative equations that was less elegant, attractors is the perfect solution to the issues I was having there. My equations looked like the this.

            special_five = (-2 * special_five ** 3 + 3 * special_five ** 2) % (10 ** (k + 1))
            special_six = 10 ** (k + 1) + 1 - special_five
    
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    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!

  • Custom User Avatar

    I like the quality of the comments, It helps demonstrate the multiple approaches that are possible. I attempted a multithreaded solution similair in the beginning and ran into issues with the limits of string length and int conversion.

  • Default User Avatar

    This problem has two attractors f and s for each magnitude of ten 10 ** 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

  • Custom User Avatar

    This bit here,

    GREEN |= {f, p-f+1}

    Would you mind helping me wrap my brain around it?