You are viewing a single comment's thread. Return to all comments →
Easy solution in Python 3
t=int(input().strip()) for _ in range(t): tn=int(input().strip()) a=((1+8*tn)**0.5-1)/2 if a==int(a): print(int(a)) else: print(-1)
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #42: Coded triangle numbers
You are viewing a single comment's thread. Return to all comments →
Easy solution in Python 3