# Project Euler/1

Jump to navigation
Jump to search

**The first problem from Project Euler** is a problem very similar to FizzBuzz. The major differences are:

- FizzBuzz usually counts to 100, while Project Euler counts to 999 (
*Not*one thousand!). - FizzBuzz prints the numbers and replaces the multiples of 3 and 5 with certain words, while Project Euler adds the multiples of 3 and 5 up, and prints that sum.

*This article is not detailed enough and needs to be expanded. Please help us by adding some more information.*

## Implementations

### Aheui

This program needs reduction due to no-op chains.

바싹밣발발발따따뚜 루벌루벋뻐터너벌벌 우뽀처빠쑥사빠아초희멍 처아아오삭도오어샥여오여

### AsciiDots

This program unfortunately fails on Try It Online, probably because Try It Online does not allow setting the value to 0.

`,` /-------\ `,` .->---{+}-~-$#& `,` /------->-----^ | `,` /*\ /*\ | | `,` /---~-+\/---~-+\ | | `,` | ! ||| ! || | | `,` .-#1000->*-{-}-*#3[%]|\*#5[%]|\*#0/ | `,` |\#1/ \---/ | \---/ | | | `,` | \------->->-----* `,` \----------------------------/

### C

#include <stdio.h> i=0,r=0;main(){while(i++<999)if(i%3==0||i%5==0)r+=i;printf("%d",r);}

### Python

By User:None1:

print(sum(filter(lambda x:x%3==0 or x%5==0,range(1,1000))))

### Shakespeare

This code may be shortened using the operators "cube" and "remainder".

The Euler Plan. Hamlet, who adds everything up. Juliet, who always counts down. Act I:a. Scene I: define constant. [ enter Hamlet and Juliet ] Hamlet: You are twice twice twice the sum of the sum of a big big big big big big big cat and a big pig and a pig. Scene II: start loop. Hamlet: you are the sum of you and a pig. Hamlet: Are you as good as the product of the quotient between you and the sum of a big cat and a cat and the sum of a big cat and a cat? If so, let us proceed to Scene III. Hamlet: Are you as good as the product of the quotient between you and the sum of a big big cat and a cat and the sum of a big big cat and a cat? If so, let us proceed to Scene III. If not, let us proceed to Scene II. Scene III: Add numbers. Juliet: You are the sum of you and me. Hamlet: Are you as good as nothing? If not, let us proceed to Scene II. Juliet: Open your heart. [ exeunt ]

### Wenyan

Warning: This program contains English letters. Code may be defective.

有數零。名之曰「H」。 有數千。名之曰「J」。 恆為是。若「J」等於零者乃止也。 減「J」以一。昔之「J」者。今其是矣。 除「J」以三。所餘幾何。 若其等於零者。 加「H」以「J」。昔之「H」者。今其是矣。 若非。 除「J」以五。所餘幾何。 若其等於零者。 加「H」以「J」。昔之「H」者。今其是矣。 云云。 云云。 云云。 吾有一數。曰「H」。書之。

## See also

<< | < | 1 | ... | 2 | 3 | 4 | 5 | 6 | ... | 28 | > | >> |
---|