One of the problems in the prime number generating thread was an accurate representation in memory of the prime numbers that had been found. Here is a proposition: for a prime number [p] let us suppose that a prime is one greater than a non prime [n] (where [n] +1 = [p]) and that a non prime can be reduced to primes [px...pn] (where [px...pn] +1 =[p]) so by only keeping the previous primes in an index [i] this allows us to represent a prime as the product of indexed values. index: 0 1 2 3 4 5 6 7 8 9 10 ... prime: 1 2 3 5 7 11 13 17 19 23 29 ... representation of primes: i prime 0 x1 -> special case: value 1 1 x2 -> special case: value 2 2 x3 -> special case: value 3 3 1.1 -> indexvalue 1 * indexvalue 1 =4, plus 1 =5 4 1.2 -> indexvalue 1 * indexvalue 2 =6, plus 1 =7 5 1.3 -> indexvalue 1 * indexvalue 3 =10, plus 1 =11 6 1.1.2 -> indexvalue 1 * indexvalue 1 * indexvalue 2 =12, plus 1 =13 7 1.1.1.1 8 2.3.3 9 2.4 10 2.2.4 and so on... an interesting question is what is the largest number of primes needed to represent a prime number as this would determine if a fixed array or a 'flexible' array would be optimum for building the index. in the absence of this info i would propose the following representation in memory mem offset to next values in mem 00 03 00 01 * 03 03 00 02 * 06 03 00 03 * 09 03 01 01 0A 03 01 02 0D 03 01 03 10 04 01 01 02 14 05 01 01 01 01 19 04 02 03 03 1D 03 02 04 20 04 02 02 04 ... * I would use 00 as a flag saying, do no operation, just take the next number! this representation uses bytes [0-255] for demonstration purposes. by using integers or even longs, it would greatly increase the possible size of your largest possible indexed value. (2^64 +1 ?) This sort of representation would be a bit slow to implement, but should allow representations of nicely large numbers. If you could determine that, for example, no more than 5 (6?, 8?) primes were needed to represent a value in your index then you could use a fixed size array. The 'wasted' space would be more than compensated for by the increased speed of access - you would no longer have to walk down all the path each time you need to get a number... The other advantage of using such an index (I believe - but I'm willing to concede that I'm getting out of my depth here...) would be for those who are interested in looking for simple cryptographic examples. :-j [hoping that this wasn't too cryptic nor X-FB]