Project Euler #6: Sum square difference

  • + 0 comments

    Kotlin 100% - Use long for the last testcase.

    private fun sumOfSquares(input: Long, sum: Long): Long{
        return if(input == 0L) sum else  sumOfSquares(input - 1, sum+(input*input))
    }
    
    private fun sumOfNumbers(input: Long):Long{
        return (input * (input+1))/2
    }