@Blaazen
I squeeze a little more juice out of it. I did the following:
The memory footprint it's not smaller, but the speed increased a little bit. I also optimized the loading process in the tree. Now the program list primes as follows:
2 -> 1,000,000 in 26 ms
2,920,000,000 -> 2,921,000,000 in ~20 sec
It can be easily implemented with TBits which will occupy just 1/8 of memory but will be slower.
Good idea. I will try it soon.