Posts

Showing posts with the label double-base palindromes

Double-base palindromes | Project Euler | Problem #36

URL to the problem page:  https://projecteuler.net/problem=36 The decimal number, 585 = 10010010012 (binary), is palindromic in both bases. Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2. (Please note that the palindromic number, in either base, may not include leading zeros.) #include   <iostream> using   namespace   std ; int   usal ( int   a ,  int   b ) {      int  result =  1 ;      for  ( int  i =  0 ; i < b; i++) {         result *= a;     }      return  result; } int   finddigits ( int   a ) {      int  cnt =  1 ;      while  (a >=  10 ) {        ...
My photo
Ercan Tomac
instagram.com/ercantomac