It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square.
9 = 7 + 212
15 = 7 + 222
21 = 3 + 232
25 = 7 + 232
27 = 19 + 222
33 = 31 + 212
It turns out that the conjecture was false.
What is the smallest odd composite that cannot be written as the sum of a prime and twice a square?
#PrimeList def isSquare?(n) return false if n<1 a=Math.sqrt(n).to_i n==a*a end def p46 i=7 while true i+=2 i+=2 while PrimeList.isPrime? i pl=PrimeList.new pl.getNext fits=false while (p=pl.getNext) < i if(isSquare?((i-p)/2)) fits=true break end end unless fits puts i return end end end