Project Euler #61: Cyclical figurate numbers
Project Euler #61: Cyclical figurate numbers
+ 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 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)
Sort 12 Discussions, By:
Please Login in order to post a comment