Skip to content

Commit

Permalink
Update docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Oct 2, 2024
1 parent 088419e commit 02a085a
Showing 1 changed file with 7 additions and 39 deletions.
46 changes: 7 additions & 39 deletions fortran/src/p0034.f90
Original file line number Diff line number Diff line change
@@ -1,49 +1,17 @@
! Project Euler Problem 34
!
! 1 ends at 1^2
! 2-9 ends at 3^2
! 10-25 ends at 5^2
! 26-49 ends at 7^2
!
! perimeter[0] = (1, )
! perimeter[i] = ((2 * i - 1)^2, (2 * i + 1)^2]
!
! .. code-block::
!
! i = 1
! 2 3 4 5 6 7 8 9
! ^ ^ ^ ^
! 2i - 1, 2 * 2i - 1, 3 * 2i - 1, 4 * 2i - 1
!
! i = 2
! 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
! ^ ^ ^ ^
! 2i - 1, 2 * 2i - 1, 3 * 2i - 1, 4 * 2i - 1
!
! i = 3
! 26 27 34 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
! ^ ^ ^ ^
!
! the corners are:
! perimeter[i][x * 2i - 1 for x in (1, 2, 3, 4)]
!
! Revision 1:
!
! Extracted the code that finds the corners
! This ended up being a filtering problem. The problem with my solution is that I
! am not satisfied with my filter at all. I feel like there is a more efficient
! way to go about it.
!
! Problem:
!
! Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:
!
! 21 22 23 24 25
! 20 7 8 9 10
! 19 6 1 2 11
! 18 5 4 3 12
! 17 16 15 14 13
! 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
!
! It can be verified that the sum of the numbers on the diagonals is 101.
! Find the sum of all numbers which are equal to the sum of the factorial of
! their digits.
!
! What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way?
! Note: as 1! = 1 and 2! = 2 are not sums they are not included.

module Problem0034
use constants
Expand Down

0 comments on commit 02a085a

Please sign in to comment.