PrimeBuffer and fermat implemented