FNS made faster by precomputing fair and square numbers