Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Kristofer Koishigawa <scissorsneedfoodtoo@gmail.com> Co-authored-by: Beau Carnes <beaucarnes@gmail.com>
		
			
				
	
	
	
		
			1.6 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			1.6 KiB
		
	
	
	
	
	
	
	
id, challengeType, isHidden, title, forumTopicId
| id | challengeType | isHidden | title | forumTopicId | 
|---|---|---|---|---|
| 5900f3901000cf542c50fea3 | 5 | false | Problem 36: Double-base palindromes | 302020 | 
Description
The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.
Find the sum of all numbers, less than n, whereas 1000 ≤ n ≤ 1000000, which are palindromic in base 10 and base 2.
(Please note that the palindromic number, in either base, may not include leading zeros.)
Instructions
Tests
tests:
  - text: <code>doubleBasePalindromes(1000)</code> should return a number.
    testString: assert(typeof doubleBasePalindromes(1000) === 'number');
  - text: <code>doubleBasePalindromes(1000)</code> should return 1772.
    testString: assert(doubleBasePalindromes(1000) == 1772);
  - text: <code>doubleBasePalindromes(50000)</code> should return 105795.
    testString: assert(doubleBasePalindromes(50000) == 105795);
  - text: <code>doubleBasePalindromes(500000)</code> should return 286602.
    testString: assert(doubleBasePalindromes(500000) == 286602);
  - text: <code>doubleBasePalindromes(1000000)</code> should return 872187.
    testString: assert(doubleBasePalindromes(1000000) == 872187);
Challenge Seed
function doubleBasePalindromes(n) {
  // Good luck!
  return n;
}
doubleBasePalindromes(1000000);
Solution
// solution required