RPL exercise - Last Digits of Primes (HP 49G, G+, 50g)
|
06-01-2019, 08:51 AM
Post: #7
|
|||
|
|||
RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g)
Hi Everyone.
Here's my take on the challenge. The algorithm is very straightforward. Get the next prime number, put it in a string, retrieve the last digit in the string, test if the digit is a 1, 3, 7, 9, or none of the above, & then add it to the list. Code:
Not great performance in Exact mode, hitting 151.9 seconds with 1000 primes starting with 7. However, in Approx. mode, I get a decent time of 86.5 seconds. Thanks for the challenge Gerson. I had fun. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)