diff --git a/fortran/problem_linker.sh b/fortran/problem_linker.sh index 85723d68..3a06f9bf 100644 --- a/fortran/problem_linker.sh +++ b/fortran/problem_linker.sh @@ -72,7 +72,7 @@ cat <> $OUTPUT_FILE end select end function run_problem - logical function is_slow(id) + pure logical function is_slow(id) integer(i4t), intent(in) :: id select case (id) EOF3 diff --git a/fortran/src/include/math.f90 b/fortran/src/include/math.f90 index d3e30ea8..e7cab247 100644 --- a/fortran/src/include/math.f90 +++ b/fortran/src/include/math.f90 @@ -4,7 +4,7 @@ module math contains - integer(i18t) function factorial(n) result(answer) + pure integer(i18t) function factorial(n) result(answer) integer, intent(in) :: n integer :: i answer = 1 diff --git a/fortran/src/include/primes.f90 b/fortran/src/include/primes.f90 index a176442c..63432a6b 100644 --- a/fortran/src/include/primes.f90 +++ b/fortran/src/include/primes.f90 @@ -78,7 +78,7 @@ subroutine clear_prime_bit(num) end subroutine clear_prime_bit ! Function to check if a bit is set - logical function get_prime_bit(num) result(bit) + pure logical function get_prime_bit(num) result(bit) integer(i18t), intent(in) :: num bit = logical(btest(prime_sieve(num / bits_per_int + 1), mod(num, bits_per_int))) end function get_prime_bit diff --git a/fortran/src/include/ranges.f90 b/fortran/src/include/ranges.f90 index 7a0fe7db..dc3ed465 100644 --- a/fortran/src/include/ranges.f90 +++ b/fortran/src/include/ranges.f90 @@ -4,12 +4,12 @@ module ranges contains - integer function range_entry3(start, step, idx) result(answer) + pure integer function range_entry3(start, step, idx) result(answer) integer, intent(in) :: start, step, idx answer = start + (step * idx) end function - integer function range_entry4(start, end, step, idx) result(answer) + pure integer function range_entry4(start, end, step, idx) result(answer) integer, intent(in) :: start, end, step, idx integer :: length, l_idx diff --git a/fortran/src/p0001.f90 b/fortran/src/p0001.f90 index 051054e6..6ea328e7 100644 --- a/fortran/src/p0001.f90 +++ b/fortran/src/p0001.f90 @@ -12,7 +12,7 @@ module Problem0001 implicit none contains - integer function p0001() result(answer) + pure integer function p0001() result(answer) integer :: i answer = 0 diff --git a/fortran/src/p0002.f90 b/fortran/src/p0002.f90 index 002daf03..019edc29 100644 --- a/fortran/src/p0002.f90 +++ b/fortran/src/p0002.f90 @@ -15,7 +15,7 @@ module Problem0002 implicit none contains - integer function p0002() result(answer) + pure integer function p0002() result(answer) integer :: a = 1, b = 2, i, tmp answer = 0 diff --git a/fortran/src/p0004.f90 b/fortran/src/p0004.f90 index d0b2358e..b534a1ea 100644 --- a/fortran/src/p0004.f90 +++ b/fortran/src/p0004.f90 @@ -8,7 +8,7 @@ module Problem0004 implicit none contains - integer function p0004() result(answer) + pure integer function p0004() result(answer) integer :: i, j, k, n, prod, length logical :: is_palindrome character(len=8) :: string diff --git a/fortran/src/p0006.f90 b/fortran/src/p0006.f90 index a0297333..8d174eae 100644 --- a/fortran/src/p0006.f90 +++ b/fortran/src/p0006.f90 @@ -19,7 +19,7 @@ module Problem0006 implicit none contains - integer function p0006() result(answer) + pure integer function p0006() result(answer) integer :: sum = 1, sum_of_squares = 1, i answer = 0 diff --git a/fortran/src/p0008.f90 b/fortran/src/p0008.f90 index bdfd0fcf..59369bbd 100644 --- a/fortran/src/p0008.f90 +++ b/fortran/src/p0008.f90 @@ -33,7 +33,7 @@ module Problem0008 use constants implicit none contains - integer(i18t) function p0008() result(answer) + pure integer(i18t) function p0008() result(answer) integer :: i, j integer(i18t) :: tmp integer(i1t), dimension(1000) :: digits diff --git a/fortran/src/p0009.f90 b/fortran/src/p0009.f90 index 2de208ba..fefc529e 100644 --- a/fortran/src/p0009.f90 +++ b/fortran/src/p0009.f90 @@ -15,7 +15,7 @@ module Problem0009 implicit none contains - integer function p0009() result(answer) + pure integer function p0009() result(answer) integer :: a, b, c = 3, a_square, b_square, c_square do diff --git a/fortran/src/p0011.f90 b/fortran/src/p0011.f90 index 24c140fd..f41f7d02 100644 --- a/fortran/src/p0011.f90 +++ b/fortran/src/p0011.f90 @@ -34,7 +34,7 @@ module Problem0011 use constants implicit none contains - integer(i18t) function p0011() result(answer) + pure integer(i18t) function p0011() result(answer) integer(i2t), dimension(20, 20) :: grid integer(i18t) :: tmp integer :: i, j diff --git a/fortran/src/p0013.f90 b/fortran/src/p0013.f90 index ac392fb0..b2686e44 100644 --- a/fortran/src/p0013.f90 +++ b/fortran/src/p0013.f90 @@ -108,7 +108,7 @@ module Problem0013 use constants implicit none contains - integer(i18t) function p0013() result(answer) + pure integer(i18t) function p0013() result(answer) integer(i18t), dimension(3, 100) :: numbers integer(i18t), dimension(3) :: arr = (/ 0, 0, 0 /) integer(i18t) :: ten18 = 1000000000000000000_8 diff --git a/fortran/src/p0017.f90 b/fortran/src/p0017.f90 index 9f12aa4e..e498de17 100644 --- a/fortran/src/p0017.f90 +++ b/fortran/src/p0017.f90 @@ -18,7 +18,7 @@ module Problem0017 implicit none contains - integer recursive function to_string_len(n) result(answer) + pure integer recursive function to_string_len(n) result(answer) integer, intent(in) :: n integer :: tmp answer = 0 @@ -71,7 +71,7 @@ integer recursive function to_string_len(n) result(answer) end if end function - integer function p0017() result(answer) + pure integer function p0017() result(answer) integer :: x answer = 0 diff --git a/fortran/src/p0028.f90 b/fortran/src/p0028.f90 index d486a1f2..40ad6776 100644 --- a/fortran/src/p0028.f90 +++ b/fortran/src/p0028.f90 @@ -49,7 +49,7 @@ module Problem0028 use ranges implicit none contains - integer function p0028() result(answer) + pure integer function p0028() result(answer) integer :: i, start answer = 1 diff --git a/fortran/src/p0034.f90 b/fortran/src/p0034.f90 index 88424d76..97fb87a1 100644 --- a/fortran/src/p0034.f90 +++ b/fortran/src/p0034.f90 @@ -18,7 +18,7 @@ module Problem0034 use math implicit none contains - integer(i18t) function p0034() result(answer) + pure integer(i18t) function p0034() result(answer) integer :: i, j integer(i18t) tmp character(len=5) string diff --git a/fortran/src/p0076.f90 b/fortran/src/p0076.f90 index 5ee30d2f..47d095d7 100644 --- a/fortran/src/p0076.f90 +++ b/fortran/src/p0076.f90 @@ -41,7 +41,7 @@ module Problem0076 use constants implicit none contains - integer function p0076() result(answer) + pure integer function p0076() result(answer) integer :: idx, i, sum = 100 integer, dimension(100) :: counts answer = 0 diff --git a/fortran/src/p0836.f90 b/fortran/src/p0836.f90 index de660128..6c9aae6e 100644 --- a/fortran/src/p0836.f90 +++ b/fortran/src/p0836.f90 @@ -17,7 +17,7 @@ module Problem0836 implicit none integer, parameter :: p0836_len = 14 contains - character(p0836_len) function p0836() + pure character(p0836_len) function p0836() p0836 = 'aprilfoolsjoke' end function p0836 end module Problem0836