Categories
Problems Project Euler

Calculating N^2 as a series?

I am working on a problem from project Euler solving for Pythagorean triplets. I think it is supposed to be a simple coding problem solved brute force with two for loops. Something about the problem has my gut telling to try to solve the problem a little more elegantly.  To that end I was looking at trying to calculate N^2 as a series so I could break up the triplets into over common and different components to manipulate.

This is the first thing that jumped out at me – obvious pattern when I thought about N^2 having 2N as the first derivative and 2 as the second – but I did not see it right away. Might be useful.

Leave a Reply