Skip to content

Commit ea5ab63

Browse files
committed
Added solution to PE001 in Go.
1 parent 4505a6e commit ea5ab63

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Go/PE001/main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package main
2+
3+
import "fmt"
4+
5+
func sum_n(n, d int) int {
6+
n = int(n/d)
7+
return int(d * n * (n + 1) / 2)
8+
}
9+
10+
func main() {
11+
fmt.Println(sum_n(999, 3) + sum_n(999, 5) - sum_n(999, 15))
12+
}

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ProjectEuler
33

44
Efficient programming solutions to Project Euler (https://projecteuler.net/) problems.
55

6-
Programming languages in which solutions are provided: Ada, Assembly, C, C#, Clojure, D, Erlang, Fortran, Groovy, Haskell, Java, Lisp, MPL, OCaml, Pascal, Perl, Python, Ruby, Scala, Scheme and Tcl. More languages may be added later.
6+
Programming languages in which solutions are provided: C, Haskell, Java, MPL, Python. More languages may be added later.
77

88

99
The programs were executed on a machine with the following configuration:
@@ -21,6 +21,10 @@ C
2121
-
2222
The compiler used is the GNU Compiler Collection (GCC), version 5.1.0.
2323

24+
Go
25+
--
26+
The compiler used is GCC Go, version 5.1.0.
27+
2428
Haskell
2529
-------
2630
The compiler used is the Glasgow Haskell Compiler (GHC), version 7.10.1.

0 commit comments

Comments
 (0)