Project Euler #1: Multiples of 3 and 5

  • + 0 comments

    def helper(n,k): p=(k-1)//n return n*p*(p+1)//2

    def multiple(number): return ( helper(3,number) +helper(5,number)-helper(15,number) ) this function has passed all the test cases as it eliminates the use of traditional for loops and use of mathematical expressions