HP Forums
(19C) Prime numbers up to 10'000 - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (19C) Prime numbers up to 10'000 (/thread-10243.html)



(19C) Prime numbers up to 10'000 - Jurgen Keller - 02-25-2018 06:35 PM

Recently I stumbled across an old BYTE article about a program for the HP-19C which computes the prime numbers up to 10'000. You'll find the article, the program and even a time lapse video in my blog article: Primzahlen mit dem HP-19C


RE: (19C) Prime numbers up to 10'000 - rprosperi - 02-25-2018 09:30 PM

(02-25-2018 06:35 PM)Jurgen Keller Wrote:  Recently I stumbled across an old BYTE article about a program for the HP-19C which computes the prime numbers up to 10'000. You'll find the article, the program and even a time lapse video in my blog article: Primzahlen mit dem HP-19C

Nice article Jurgen. I liked that your video showed the setup for the slo-mo photography. Who would have guessed that a rolling pin was an essential prop for hi-technology photography?

And by coincidence, that same Byte issue includes an article about "Darth Vader's Force Battle" program for the TI-59 that explains how to generate some of the TI 58/59 synthetic instructions. I recently acquired a series of old TI manuals and programs that includes the author's original program sheets for this program and a copy of the Byte article, but it was not dated so I could not locate it.

Thanks!


RE: (19C) Prime numbers up to 10'000 - Gerson W. Barbosa - 02-26-2018 04:43 AM

Quote:Unfortunately, the paper ran out ... ... at about 9’300.

The expected number of primes less than 10000 is about

10000/(ln(10000) - 1) ~ 1218,

which would require at least 3.10 meters of paper on the 82240B IR printer (apparently 1/10 inches per line).

HP 50g program:

« 1
DO NEXTPRIME PR1 DUPDUP
UNTIL 9997 >
END
»

Notice 1 is not prime.

Nice video anyway.


RE: (19C) Prime numbers up to 10'000 - Jurgen Keller - 02-27-2018 05:32 PM

(02-26-2018 04:43 AM)Gerson W. Barbosa Wrote:  
Quote:Unfortunately, the paper ran out ... ... at about 9’300.

The expected number of primes less than 10000 is about

10000/(ln(10000) - 1) ~ 1218,

which would require at least 3.10 meters of paper on the 82240B IR printer (apparently 1/10 inches per line).

I have to admit I did not prepare well enough. However, bad luck was also part of the game: in the first run there was a paper jam after a few hundreds of numbers. I took the bad decision to rerun the program without installing a fresh paper roll :-(

Quote:HP 50g program:

« 1
DO NEXTPRIME PR1 DUPDUP
UNTIL 9997 >
END
»

Impressively short and elegant (and of course way faster), however, there are nearly 30 years between the introduction of the 19C and 50g.

Quote:Notice 1 is not prime.

True, and that's a minor error in the 19C program from the BYTE magazine. I just didn't want to change it and run the original program.


RE: (19C) Prime numbers up to 10'000 - Jurgen Keller - 02-27-2018 05:59 PM

(02-25-2018 09:30 PM)rprosperi Wrote:  
(02-25-2018 06:35 PM)Jurgen Keller Wrote:  Recently I stumbled across an old BYTE article about a program for the HP-19C which computes the prime numbers up to 10'000. You'll find the article, the program and even a time lapse video in my blog article: Primzahlen mit dem HP-19C
And by coincidence, that same Byte issue includes an article about "Darth Vader's Force Battle" program for the TI-59 that explains how to generate some of the TI 58/59 synthetic instructions.
Thank you for this hint, I've missed that article. There must be a TI 59 somewhere and it will be happy to get some attention!