Project Euler #61: Cyclical figurate numbers

Sort by

recency

|

12 Discussions

|

  • + 0 comments

    For those who hate hard coding each individual equations

    def gon(N, n):
        return ((N-2) * n**2 + (4-N) * n) // 2
    

    Triangular(n) -> gon(3, n), Square(n) -> gon(4, n), Pentagon(n) - gon(5, n), ...

  • + 2 comments

    Finally get what duplicates actually means here. To begin with, the answer set should be distinct. But if you're stuck with #7, you might want to know that any answer should contain no repeating elements to be valid (e.g. [1651, 5151, 5151, 5192, 9216] is not an answer for any input).

    • + 0 comments

      Thank you very much with tutorial for testcase 7, this is problem very exciting !!!

    • + 0 comments

      Thanks mate. I was unable to understand why my submissions broke case #7 and you comment helped me crack it.

      Their formulation is quite unclear on that particular point to be honest.

      Beside that, great fun solving that problem !

      Cheers

  • + 0 comments

    if different cyclical figurate numbers have the same sum, are they considered like duplicates?

  • + 0 comments

    For those struggling with test #7: "Each polygonal type: triangle (P3,127=8128)(P3,127=8128), square (P4,91=8281)(P4,91=8281), and pentagonal (P5,44=2882)(P5,44=2882), is represented by a different number in the set."

    This phrase basically means that the set that you've found cannot have duplicates in it.

  • + 1 comment

    Hahaha... I have finally figured out that each number in the answer must be on a separate line (rather than space separated on a single line)

    • + 0 comments

      wow. I only see the people here saying "Oh, my test case 7 does not work". But you information really helped me. It's not written that they need to be in seperate lines...