Prime numbers test and generation