Project Euler/28

From Esolang
Jump to navigation Jump to search

Back to User:ProjectEuler

Project Euler Problem 8 is a problem related to the well known number spiral. The spiral expands indefinitely in all four directions, as shown below. The task is to find the sum of the numbers on the diagonals of the 1001 by 1001 spiral formed the same way, starting from the "1" at the center. However, many of the programs listed here utilizes the relationship between the numbers in the spiral, instead of the actual position of the numbers.

43 44 45 46 47 48 49
42 21 22 23 24 25 26
41 20 7 8 9 10 27
40 19 6 1 2 11 28
39 18 5 4 3 12 29
38 17 16 15 14 13 30
37 36 35 34 33 32 31
This article is a stub, which means that it is not detailed enough and needs to be expanded. Please help us by adding some more information.

Implementations

Aheui

Please note that the variable that functions like Ajax in the Shakespeare program counts down from 8, rather than 4 in other programs. This is done to shorten the program a little.

발발나싹박싼발발나산뺘투뱗텨뱛볎뱕뗘뱍뗘떠
싹삭다삳밧타뿌섣썯도볋처삭망희
뽀더서써뻐선처마산본

Rockstar

Heiss is hardworking
Juda is hardworking.
Jei is hard-working.
While Jei is weaker than 1002
Arr is blow.
While Arr is not gone
Let Juda be with Jei.
Let Heiss be with Juda.
Knock Arr down.

Build Jei up, up....

Say Heiss.

Shakespeare

Note at Problem 2.

Scotchgate conspiracy.

Hamlet, who adds everything up.
Juliet, who sends messages to Hamlet.
Julia, who sends messages to Juliet.
Ajax, who can only count to four.

Act I: x.
Scene I: Initialization.

[ enter Hamlet and Juliet ]

Hamlet: you cat.
Juliet: you cat.

[ exit Juliet ]
[ enter Julia ]
Hamlet: you big cat.

[ exeunt ]
Scene II: Start outer loop.
[exeunt]
[ enter Hamlet and Julia ]
Hamlet: Are you as good as the sum of a big cat and the cube of twice the sum of a big big cat and a cat?
If so, let us proceed to Scene V.
[ exit Julia ]
[ enter Ajax ]
Hamlet: You big big cat!
[ exeunt ]

Scene III: Start inner loop.
[ exeunt ]
[ enter Julia and Ajax ]
Julia: Are you as good as nothing?
If so, Let us proceed to Scene IV.
[ exit Ajax ]
[ enter Juliet ]
Julia: You are the sum of you and me.
[ exit Julia ]
[ enter Hamlet ]
Juliet: you are the sum of you and me.
[ exit Juliet ]
[ enter Ajax ]
Hamlet : you are the sum of you and a pig. Let us proceed to Scene III.

Scene IV: end inner loop.
[ exeunt ]
[ enter Hamlet and Julia ]
Hamlet: You are the sum of you and a big cat. Let us proceed to Scene II.

Scene V: end outer loop.
[ exeunt ]
[ enter Hamlet and Julia ]
Julia: Open your heart.
[ exeunt ]

Wenyan

有數一。 名之曰「和」。
有數一。 名之曰「上」。
有數二。 名之曰「下」。

恆為是。若「下」大於千者乃止也。
 為是四遍。
  加「下」以「上」。昔之「上」者。今其是矣。
	加「上」以「和」。昔之「和」者。今其是矣。
 云云。
 加「下」以二。昔之「下」者。今其是矣。
云云。

吾有一數。曰「和」。書之。

External resources

  • Problem 28 on Project Euler Official Website (not available)
  • Problem 28 on Project Euler Mirror