Josheli
  • Home
  • Blog
    • Knob
    • Running
    • Soccer
    • Technology
  • About
Knob , Technology

Project Euler Problem 1

by dv January 10, 2012 No Comments

Endeavoring to be more of a producer than a consumer, ran across Project Euler which looks to be low friction but somewhat useful and interesting. Unfortunately their register/login system is broken:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/admin/domains/projecteuler.net/public_html/includes/login_preprocess.php on line 11

So I’ll keep track on my own blog I guess and see how far along I get.

Problem 1:

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

And my solution, in PHP:

$sum = 0;

for($i = 0; $i < 1000; ++$i) { if(!($i % 3) || !($i % 5)) { $sum += $i; } } echo number_format($sum); [/php] Answer: 233,168

Related Content:

  • Project JoRViP: Josheli Running Video Producer by Dv February 2, 2022 I produce videos for the Josheli Running YouTube channel. Producing videos is tedious and time-consuming. It'd be great if I…
  • MariaDB or MySQL Root Password Struggles on Debian/Ubuntu by Dv March 14, 2018 Had a difficult time authenticating to a newly installed MariaDB 10.1 instance on Debian 9 (Stretch) recently, wasting a couple…
  • Reason Number 48 Drupal Drives Me Crazy by Dv November 13, 2013 A user requests the ability to browse and insert links to nodes (pages) from the WYSIWYG editor, similar to how…
  • Single Sign-on in Caddy Server Using only the… by Dv February 24, 2021 As mentioned, I've started self-hosting a lot of services, and in front of them all I have a reverse proxy…
  • Aptana Studio 3 Sync with Mapped Drives by Dv December 2, 2011 Soldiering on with Aptana, fighting as I go, here's how I was able to set up automatic synchronization between my…
It's only fair to share...Share on facebook
Facebook
Share on twitter
Twitter
Share on email
Email
  • Previous Aptana Studio 3 Sync with Mapped Drives14 years ago
  • Next Reason Number 48 Drupal Drives Me Crazy14 years ago

Leave a Reply

Your email address will not be published. Required fields are marked *

Popular Posts

  • Josheli, What Happened? (55,843)
  • Stupidly Simple, Static, Startpage for Self-hosted Services (32,053)
  • Three Saturdays (28,391)
  • Running a Plex Media Server on an Old Laptop (26,770)
  • Simple Google Photos: A WordPress Plugin (23,500)

Random Read

Training Compensation for Youth Clubs
Here's an interesting article discussing (the lack of) training compensation for USA youth clubs. If…

Read More

Google Photo
Google Photo
Google Photo
Google Photo

Social Things

  • Family Vance
  • Texas Longhorns News

RSS From Familyvance

2025 Josheli. Donna Theme powered by WordPress