Project Euler Problem 94 Statement
Solution
Python Source Code
for _ in range(int(input())):
N = int(input())
side0, side, s, p, m = 1, 1, 0, 0, 1
while p <= N:
side0, side, m = side, 4*side - side0 + 2*m, -m
s+= p
p = 3*side - m
print(s)