Categories
Book Notes Problems Project Euler

N^2 as a series

So the series was pretty obvious in retrospect – the summation of integer values from 1 to N has a known series that is so close I should have seen I could start there and work backwards. Ugh.

Yeah, I know I could Google this stuff – but where’s the fun in that?

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.

Categories
Problems Project Euler

Project Euler – Solution to problem #1

Project Euler Problem #1:

Problem: “If we list all the natural numbers below 10 that are multiples of 3 or 5 we get 3,5,6,9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.”

Solution: