If you’d like to play around with prime numbers, like I did in my Prime Patterns post, then you’ll need an array of primes. Here are the two that I created. One has the first 10,000 prime numbers and the other has the first 64,000 prime numbers – it’s actually just short of 64,000. Here’s the gist of the class:
package VO {
public class Primes10000 {
public static var primes : Vector. = new [
2,3,5,7,11,13,17,19,23,29,
31,37,41,43,47,53,59,61,67,71,
Obviously for testing purposes you can use the Primes10000 so that you can rapidly compile and loop through the array. Then if you need to go big you can easily switch to Primes64000.
NOTE: Do NOT try and open the Primes64000 class in Eclipse. At best it will slow everything down. At worst it will crash Eclipse. There’s really no need to open either of these classes but if you do want to then I’d suggest using a basic text editor. ( Consider yourself warned. )





Cool – thanks for sharing. I really like your Prime Patterns post.
I think these classes might work faster if you defined the vector's data type, specified it as fixed and added the length.
@Lawrie That’s a good point. But I’m not sure how I would declare the length as fixed with a static class. Obviously a limitation of static. Perhaps I should make it so that the class is instantiated then I could set the length to fixed. And it would be worth checking out if it actually did increase the performance.