Posts

Showing posts with the label problem 46

Goldbach's other conjecture | Project Euler | Problem #46

URL to the problem page:  https://projecteuler.net/problem=46 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 + 2×1 2 15 = 7 + 2×2 2 21 = 3 + 2×3 2 25 = 7 + 2×3 2 27 = 19 + 2×2 2 33 = 31 + 2×1 2 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? #include   <iostream> using   namespace   std ; int   power ( int   a ,  int   b ) {      int  result =  1 ;      for  ( int  i =  0 ; i < b; i++) {         result *= a;     }      return  result; } int   main () {      int  i, j, a, b, n, cnt, cnt...
My photo
Ercan Tomac
instagram.com/ercantomac