Count in factors: Difference between revisions

mNo edit summary
Line 599:
 
=={{header|FORTRAN}}==
Please find the example output along with the build instructions in the comments at the start of the FORTRAN 2008 source. Compiler: gfortran from the GNU compiler collection. Command interpreter: bash. The code writes j assertions which don't prove primality of the factors but does prove they are the factors.
 
This algorithm creates a sieve of Eratosthenes, storing the largest prime factor to mark composites. It then finds prime factors by repeatedly looking up the value in the sieve, then dividing by the factor found until the value is itself prime. Using the sieve table to store factors rather than a plain bitmap was to me a novel idea.
 
<lang FORTRAN>
Anonymous user