You are viewing a single comment's thread. Return to all comments →
Python3. Simple brute force. Boring.
param = {3:(1, 1, 1), 5:(1, 1, 3), 6:(1, 1, 4)} def double_seq(n, a, b): v1, d1, dd1 = param[a] v2, d2, dd2 = param[b] while v2 < n: if v1 == v2: print(v1) if v1 < v2: d1 += dd1 v1 += d1 else: d2 += dd2 v2 += d2 n, a, b = map(int, input().split()) double_seq(n, a, b)
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #45: Triangular, pentagonal, and hexagonal
You are viewing a single comment's thread. Return to all comments →
Python3. Simple brute force. Boring.