POV-Ray : Newsgroups : povray.off-topic : Project Euler : Re: Project Euler Server Time
11 Oct 2024 05:21:12 EDT (-0400)
  Re: Project Euler  
From: John VanSickle
Date: 25 Nov 2007 00:40:54
Message: <47490ae6@news.povray.org>
Mueen Nawaz wrote:
> Hi,
> 
> 	Just found this a few days ago. It's apparently been around for years,
> so some of you may know about it:
> 
> http://projecteuler.net/index.php?section=about

Coming back to it, the first one is easily done without a computer.

The sum of the numbers in any range that are divisible by 3 or 5 is 
equal to the sum of the numbers that are divisible by three, plus the 
sum of the numbers that are divisible by five, minus the sum of the 
numbers that are divisible by 15.

Our given range is from 1 to 999, so:

(3+999)*333/2 + (5+995)*(199)/2 - (15+990)*66/2 = 233168.

I used a calculator for the multiplying and adding here.

Regards,
John


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.