Sort 12 Discussions, By:
Please Login in order to post a comment
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),
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).
[1651, 5151, 5151, 5192, 9216]
if different cyclical figurate numbers have the same sum, are they considered like duplicates?
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.
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)