Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- testlist = [x for x in range(5, 10**8) if str(x) == str(x)[::-1]]
- groupSize, answers = 2, []
- upper = int((10 ** 8 / groupSize) ** 0.5) + 1
- while upper >= groupSize / 2:
- print(upper, groupSize)
- first = 1
- while first != upper:
- total = 0
- for y in range(first, first + groupSize):
- total += y ** 2
- if total in testlist:
- answers.append(total)
- first += 1
- first = 0
- groupSize += 1
- upper = int((10 ** 8 / groupSize) ** 0.5) + 1
- answers = set(answers)
- print(len(answers))
- print(sum(answers))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement