Project Euler Problem #36

in code


function range(start, end) {
    return [...Array(end + 1).keys()].slice(start);
}

function palindrome(number) {
    return number.toString() === number.toString().split('').reverse().join('');
}

function toBinary(number) {
    return (number >>> 0).toString(2);
}

function add(sum, current) {
    return sum + current;
}

const palindromes = range(1, 999999).filter(number => {
    return palindrome(number) && palindrome(toBinary(number));
});

console.log(palindromes.reduce(add));


Remap a JavaScript Object

in code

Blog Silence

in me

Run Clare 2019 Race Series

in running


Your email address will not be published. Required fields are marked *