Prime Number Generators

The Partridge Family were neither partridges nor a family. Discuss.
albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Prime Number Generators

Post by albinopapa » March 25th, 2017, 5:51 pm

Yeah more like 18 quintillion
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: Prime Number Generators

Post by LuisR14 » March 25th, 2017, 10:53 pm

i guess i went the "long-scale" format :P (with long-scale it'd be 18 Trillion, which i deem the appropriate form, and with short-scale would be 18 Quintillion i guess)
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Prime Number Generators

Post by albinopapa » March 26th, 2017, 5:03 am

Ah, yeah you ain't that old Luis, and you live in 'Merica lol.

I had to look this up since you mentioned "long-scale" and "short-scale".
https://en.wikipedia.org/wiki/Names_of_large_numbers

I had seen a video on this a while back, use to people changed the prefix every million instead of every thousand.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: Prime Number Generators

Post by LuisR14 » March 26th, 2017, 5:52 am

hehe yea, i'm not old, but i'm a US-born hispanic dude, so I basically went with what LatinAmerica uses xD (also because it felt natural to count hundreds, then thousands, then millions, rinse-repeat o_o)
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

JDB
Posts: 41
Joined: August 5th, 2015, 9:50 am
Location: Australia

Re: Prime Number Generators

Post by JDB » March 26th, 2017, 6:06 am

chili wrote:Yeah, divide only primes, divide only up to sqrt(n), only examine odd numbers.
A long time ago I implemented a string based long division algorithm for this very purpose. It was an interesting little challenge and the resulting algorithm was actually quite fast, I recall getting thousands of digits of decimal precision in microseconds for a division operation. The only limitation was that the divisor could be no more than two digits long, however the dividend could be an arbitrarily large integer, which was a limitation of the long division process I modeled the code after. I think the code is sitting on an old dead hard drive so unfortunately I cannot share it.

EDIT: actually I think I limited the decimal precision because it wasn't really necessary, what actually amazed me was that I could divide an integer with thousands of digits by any two digit integer and got a result in a fraction of a second. However I'm sure there would be ways to extend the algorithm I wrote to support more than a two digit divisor.

Post Reply