import java.util.ArrayList;

public class Brilliant {
	ArrayList<Integer> brilliants = new ArrayList<Integer>();

	public Brilliant() { }

	public Brilliant(int n) {
		initBrilliants(n);
	}

	public int nextBrilliant() {
		// If no brilliants have been stored, we know the smallest brilliant number
		// is four, so we'll start by setting num to 3. (It will get set to four
		// immediately in the below while loop as ++num means "add one to num, then
		// use the variable num".)
		//
		// If there have been brilliants established, start counting from the last
		// found brilliant number.
		int num = brilliants.size() == 0 ? 3 : brilliants.get(brilliants.size()-1) + 1;

		while (!(Main.isBrilliant(++num)));

		return num;
	}

	public void initBrilliants(int n) {
		for (int i = 0; i < n; i++) {
			brilliants.add(nextBrilliant());
		}
	}

	public ArrayList<Integer> getBrilliants() {
		return brilliants;
	}

	public int size() {
		return brilliants.size();
	}
}