yoy.be "Why-o-Why"

2011 ...

januari (2) februari maart (2) april (3) mei juni juli (1) augustus september (2) oktober november (4) december (3)

prime numbers

2011-03-14 00:36  i2957  freeware  [permalink]

I once had the idea of building a sieve to find primes, with two arrays of integers: one array with the primes found so far, and one array with a multiple of the corresponding prime which is just above the number currently being investigated. If a multiple would match, it's not a prime, if I wouldn't find a multiple in all previously found primes, I've got a new prime. This way I would not have to multiply or trial-divide anything. All you have to do is start with a first element set to 2, and 'investigate' 3. This is the next prime of course, and 4 hits the next multiple of 2 that's larger than 3 already.

The first go was long (long!) ago back in 16-bits. It found primes up to 65521. But we're having multiple 64-bit monsters purring on our laps nowadays, so I had another go. Turns out the technique spits out primes in sequence faster than I/O can handle, so I had to optimize a bit. Finding all 32-bits primes took a few hours, so I started a 64-bits version somewhere in februari and left it running on a machine I have in the attic that also records television stuff now and then.

I'm not sure if anyone can use all of the prime numbers in sequence for something, but there it is. If you want a copy, let me know. I could also make a version of the program that runs on several cores. I could also make a client that gets ranges of numbers to check for primes and post them back. But I'm not planning to do that. I suspect I won't find anything ground-breaking in the primes-world this way.

It does make a nice tool to list sets of primes, and the primes list is great to split any (large) number in its prime factors. Have a look: (but please don't overload my spare machine in the attic!)

primes...

Update: source code is available here: https://github.com/stijnsanders/primes

http://yoy.be/home/primes/

bitcoin: digital currency of the people (be your own bank)

2011-03-23 16:45  i2959  internet actueel beurs coding politiek weblog  [permalink]

I've been asked if I accept donations for the freeware I make available over this website, but I don't. I don't have a legal entity to my name to accept any funds for work done, and frankly I don't even care for checking if and how I could get this in the clear with the tax services.

Today I read about http://www.bitcoin.org/ and this looks like exactly what I need. It's not that hard to set up, and the fact that no institute like a bank is envolved is really interesting. Even the 'funds' itself actually measures in 'mathematical solids in the digital world', so if I were to amass e certain amount of it, it would get financially interesting to check out these aforementioned tax issues (perhaps by an accountant...)

So, if anyone wants to wire me anything (even 0.01BTC just to check if it works) here's a bitcoin address:

1Q5omBMcpRQkx7WqPpHceM37ZBqpCgyrDB

http://www.bitcoin.org/