rename statics/euler and sync b93 code with main repo
This commit is contained in:
23
www/statics/euler/Euler_Problem-028_explanation.md
Normal file
23
www/statics/euler/Euler_Problem-028_explanation.md
Normal file
@@ -0,0 +1,23 @@
|
||||
Let's look ate the diagonal numbers of our 5x5 grid:
|
||||
|
||||
|n |info |
|
||||
|--|---------------|
|
||||
|25|starting number|
|
||||
|21| = 25 - **4** |
|
||||
|17| = 21 - **4** |
|
||||
|13| = 17 - **4** |
|
||||
|9 | = 13 - **4** |
|
||||
|7 | = 9 - **2** |
|
||||
|5 | = 7 - **2** |
|
||||
|3 | = 5 - **2** |
|
||||
|1 | = 3 - **2** |
|
||||
|
||||
You can probably see the pattern here. The rest of the algorithm is simply loop from 1001^2 to 1, subtracting the right amount each round and in the end summing up all numbers.
|
||||
|
||||
I have this little code to calculate the sum of stack values until a zero is encountered:
|
||||
|
||||
```befunge
|
||||
>+\:#<_$
|
||||
```
|
||||
|
||||
Perhaps it's useful for someone else.
|
||||
Reference in New Issue
Block a user