GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — JavaScript/Project-Euler/Problem005.js at master · TheAlgorithms/JavaScript Expand file tree/ Copy pathProblem005.jsMore file actions 20 lines (16 loc) · 572 Bytes / Copy pathProblem005.jsFile metadata and controls20 lines (16 loc) · 572 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 /* Smallest multiple 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? */ export const findSmallestMultiple = (maxDivisor) => { const divisors = Array.from({ length: maxDivisor }, (_, i) => i + 1) let num = maxDivisor + 1 let result while (!result) { const isDivisibleByAll = divisors.every((divisor) => num % divisor === 0) if (isDivisibleByAll) result = num else num++ } return result } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |