Skip to content

Instantly share code, notes, and snippets.

@Aadithya-V
Last active May 14, 2023 18:09
Show Gist options
  • Save Aadithya-V/7d2bf0fa841d73b7b05bee0fb2398e5c to your computer and use it in GitHub Desktop.
Save Aadithya-V/7d2bf0fa841d73b7b05bee0fb2398e5c to your computer and use it in GitHub Desktop.
ProjectEuler.net Problems 1-100

Solutions to problems 1 to 100 of projecteuler.net. Solutions to problems >100 are not permitted to be published publically.

Click this gist to view the folder of gists or go to https://gist.github.com/Aadithya-V/7d2bf0fa841d73b7b05bee0fb2398e5c

Mostly implemented in golang. Sharing the beautiful code :)

I recommend to not look at the solutions and try to solve on your own. It's fun!

These gists will be removed by the end of 2023.

""" Problem Statement : If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000. """
sum = 0
for i in range(1,1000) :
if(i%3 == 0 or i%5 == 0) :
sum += i
print("The sum of all the multiples of 3 or 5 below 1000 is : "+ str(sum))
package main
import (
"fmt"
)
func Fibbonacci(c chan<- uint64, max uint64) {
var i, j uint64 = 0, 1
for i <= max {
c <- i
i, j = j, i+j
}
close(c)
}
func solution() uint64 {
var _max uint64 = 4000000
c := make(chan uint64, 1000)
go Fibbonacci(c, _max)
var count uint64 = 0
for i := range c {
if i%2 == 0 {
count += i
}
}
return count
}
func main() {
fmt.Print(solution())
}
// Answer: 4613732
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment