part of 1.2 (prime? is needed in 1.3.1) and code from 1.3.1