On 25/06/2021 9:26 pm, Dave Jousma wrote:
I looked at the video, and looks like he is running for 5 seconds, but cannot 
tell how many prime numbers he calculated on the platforms he was testing.   I 
had an old COBOL program laying around from years ago that calculates prime 
numbers.   This morning I cranked it up to a limit of 50,000,000 and it 
completed in 6 seconds.  This is on enterprise cobol 6 on z15.

The program searches for all primes up to 1,000,000, throws away the result and repeats as many times as it can in 5 seconds (it's a drag race, the task doesn't need to be useful). My laptop (i5-7200U) does 6500 passes. I think the algorithm has been tweaked and improved since he made the video.

I set the limit to 100,000,000 (the source validates results for multiples of 10) and got 10 passes in 5 seconds on my laptop. At 100,000,000 the bit map doesn't fit in processor cache which might be a significant penalty. 1,000,000 gives better granularity in the results.

For kicks I tried a limit of 1,000,000,000 which did 1 pass for 50,847,534 primes in 6.7 seconds.

Someone wrote a GNUCobol solution - I have no idea how good it is:
https://github.com/PlummersSoftwareLLC/Primes/tree/drag-race/PrimeCOBOL/solution_1

z/OS COBOL and assembler solutions would be interesting.

Andrew Rowley




----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to