You are viewing a single comment's thread. Return to all comments →
python
from math import sqrt for _ in range(int(input())): n = int(input()) s = sqrt(1+8*n) if s % 2 == 1: print(int((s - 1) // 2)) 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 →
python