![]() |
The AFU and Urban Legend Archive AFU Snide fortran prime numbers
|
![]() |
From: PAPAI@kcgl1.eng.ohio-state.edu (Jonathan Papai)
Newsgroups: alt.folklore.college,alt.folklore.urban,alt.folklore.computers
Subject: Re: Questionnaire
Date: 16 May 1994 17:45:15 GMT
In Message-ID: <mhaynes.769026388@bgsuvax>
On or about 15 May 94 18:26:28 GMT
mhaynes@bgsu.edu (Michael F. Haynes) posted:
> {Forgive me if I've been "trolled" but I've seen responses like this to
> similar situations one too many times. Also, FWIW, I don't advocate
> things like people in comp.lang.pascal writing people's code for them.
Speaking of writing code, I've discovered the most efficient algorithm that ouputs all the positive integer prime numbers less than a user-selected value. I don't know PASCAL, so I'll type it in in FORTRAN.
C This program copywrite J.P.Papai (1994).
C Use of this program is allowed north of
C the equator, free of charge.
C
C J is the user input.
C
PROGRAM PRIME
READ(*,*)J
DO 10 I=1,J
10 WRITE(*,*)I
STOP
END
This program outputs not only primes, but, as an added feature, also compound numbers.
I hope this algorithm can be added to the FAQ, so this question can be answered more simply next time.
Jon " your obedient servant " Papai
|
Any proceeds (net proceeds from merchandise sales) from TAFKAC solely
benefit The Chuck Reed Fund.
Copyright Information http://tafkac.org/ |