Project Euler is a math problem set. I occasionally solve PE problems for fun. Welcome!
Dependencies | Options |
---|---|
Fortran 2008 compliant Compiler | gfortran/ifx |
Build Tool | Fortran Package Manager (FPM) |
fpm run PE-Fortran [-- p<problem number> [--trail <number of trails/problem>]]
# Example1, solve all problems: fpm run PE-Fortran
# Example2, solve all problems 10 times: fpm run PE-Fortran -- -t 10
# Example3, solve problem 10: fpm run PE-Fortran -- p10
# Example4, solve problem 10 for 100 times: fpm run PE-Fortran -- p10 -t 100
# Example5, solve all problems faster: fpm run PE-Fortran --profile release
fpm run PE-Fortran --compiler ifx --flag "-check all,nouninit"
If you would like to contribute:
Add your file problem_xxxx.f90
to src/problems
, where xxxx
is the problem number with leading zeros. If a data file is required, add your data file data_xxxx.txt
to data/
. The syntax of a solution submodule should follow
submodule(module_problem) submodule_eulerxxxx
implicit none
contains
module subroutine eulerxxxx(problem)
class(problem_type), intent(inout) :: problem !> Problem type
integer :: sln !> store your answer
!> If data file is required:
!> open (newunit=unit, file=problem%file)
!> ... your implementation ...
write (problem%answer, "(i20)") sln
end subroutine eulerxxxx
end submodule submodule_eulerxxxx
Update *.inc
files by using
fpm run Preprocess