We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
//Javascript solution using BigIntvarm=BigInt(n)-1n;// We need numbers strictly below nvarnumberOf3=m/3n;varnumberOf5=m/5n;varnumberOf15=m/15n;varsum3=3n*numberOf3*(numberOf3+1n)/2n;varsum5=5n*numberOf5*(numberOf5+1n)/2n;varsum15=15n*numberOf15*(numberOf15+1n)/2n;varsum=sum3+sum5-sum15;console.log(sum.toString());
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #1: Multiples of 3 and 5
You are viewing a single comment's thread. Return to all comments →