Project Euler/6
Jump to navigation
Jump to search
Project Euler Problem 6 is related to the sum of integer sequences. The task is to work out the difference between the square of the sum of integers from 1 through 100, and the sum of the squared integers from 1 through 100. However, many of the programs below calculates the sum of n×n×(n-1) for the integers n from 1 through 100 instead, and still get the correct result.
- This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
Implementations
Aheui
바싹밤발발따뚜 투너벌벌뻐뻐뻐 따따싹삭두빠초 뭉뱔벌냐셔토삭 희
C
#include <stdio.h> int h=0,j=100; int main(){ while(j>0){h+=j*j*(j-1);--j;} printf("%d",h); return 0; }
Rockstar
Jesus is a scratching rockplayer. Henry is gone. While Jesus isn't nothing Let Es be Jesus without 1. Let El be Jesus of Jesus of Es. Let Henry be with El. Knock Jesus down. Say Henry.
Shakespeare
The delivery of the broken cubes. Hamlet, who adds everything up. Juliet, who always counts down. Act I:a. Scene I: define constant. [ enter hamlet and juliet ] Hamlet: you are the square of the sum of a big big big cat and a big cat. Scene II: start loop. Juliet: you are the sum of you and the product of me and the product of me and the sum of me and a pig. Hamlet: you are the sum of you and a pig. Are you as good as nothing? If not, let us proceed to Scene II. Juliet: open your heart. [ exeunt ]
Python
Note: The end=''
in the last line is added to eliminate the trailing newline.
r=0 j=0 for j in range(1,101) : r+=j*j*(j-1) print(r,end='')
Wenyan
有數零。名之曰「H」。 有數百。名之曰「J」。 恆為是。若「J」等於零者乃止也。 減「J」以一。乘其以「J」。乘其以「J」。加其以「H」。昔之「H」者。今其是矣。 減「J」以一。昔之「J」者。今其是矣。 云云。 吾有一數。曰「H」。書之。