A positive integer N is fat if the sum of its positive divisors is not less than 3N. N is lean if the sum of its positive divisors is N+1, i.e., N is prime. N is a Jack Sprat number if N is lean and N+1 is fat. (These terms are inspired by the nursery rhyme that begins, "Jack Sprat could eat no fat, his wife could eat no lean, ...") The smallest Jack Sprat number is 179. There are infinitely many Jack Sprat numbers.
The input consists of one or more positive integers, each on a line by itself. None will exceed 1 billion. For each input N, output the nearest Jack Sprat number, with ties going to the smaller number.
Input must be read from the file "prob34.in", and output must be
written to the file "prob34.out". All output to the screen will be
ignored.
<BOF> 179 63219 2487 12345678 12 1000 897284 <EOF>
179 63179 2399 12345647 179 839 897263