Skip to content

Instantly share code, notes, and snippets.

@ajrob
ajrob / Euler5.js
Last active August 29, 2015 14:02
Euler Project Problem 5
// 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
// What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
var smallestNumber = 19;
var uDone = false;
while (!uDone) {
smallestNumber++;
for (var i = 1; i <= 20; i++){
if(!isDivisible(i, smallestNumber)){
@ajrob
ajrob / Euler4.js
Last active August 29, 2015 14:02
// A palindromic number reads the same both ways.
// The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
// Find the largest palindrome made from the product of two 3-digit numbers.
var largest = 0;
console.log(largestPalindromeByThreeDigits(100, 100));
function largestPalindromeByThreeDigits (j, i) {
for (var j = 100; j < 1000; j++){
@ajrob
ajrob / gist:afbda7aff7e9f96e4144
Created May 14, 2014 17:20
You Can't Javascript Under Pressure
function doubleInteger(i) {
// i will be an integer. Double it and return it.
return i *= 2;
}