Files
freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-36-double-base-palindromes.md
Oliver Eyton-Williams 0bd52f8bd1 Feat: add new Markdown parser (#39800)
and change all the challenges to new `md` format.
2020-11-27 10:02:05 -08:00

1.2 KiB

id, title, challengeType, forumTopicId
id title challengeType forumTopicId
5900f3901000cf542c50fea3 Problem 36: Double-base palindromes 5 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.)

--hints--

doubleBasePalindromes(1000) should return a number.

assert(typeof doubleBasePalindromes(1000) === 'number');

doubleBasePalindromes(1000) should return 1772.

assert(doubleBasePalindromes(1000) == 1772);

doubleBasePalindromes(50000) should return 105795.

assert(doubleBasePalindromes(50000) == 105795);

doubleBasePalindromes(500000) should return 286602.

assert(doubleBasePalindromes(500000) == 286602);

doubleBasePalindromes(1000000) should return 872187.

assert(doubleBasePalindromes(1000000) == 872187);

--seed--

--seed-contents--

function doubleBasePalindromes(n) {

  return n;
}

doubleBasePalindromes(1000000);

--solutions--

// solution required