Skip to content

Commit

Permalink
Attempt p7 in fortran (10)
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Oct 3, 2024
1 parent 3c2d2bf commit 3b1a947
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fortran/src/include/primes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ end function next_prime

subroutine expand_sieve(potential_n)
integer, intent(in), optional :: potential_n
integer :: new_size, new_n
integer :: new_size, new_n, i

if (present(potential_n)) then
new_n = max(potential_n, current_n)
Expand All @@ -51,7 +51,9 @@ subroutine expand_sieve(potential_n)
deallocate(is_prime)
end if
allocate(is_prime(new_size))
is_prime = -1 ! All bits set to 1
do i = 1, new_size
is_prime(i) = -1
end do
call clear_prime_bit(0)
call clear_prime_bit(1)
call sieve_up_to(new_n)
Expand Down

0 comments on commit 3b1a947

Please sign in to comment.