Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
majek committed Sep 13, 2013
1 parent fd70aa0 commit d08c743
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go/euler/euler2.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func main() {
if v > 4000000 {
break
}
if v % 2 != 0 {
if v%2 != 0 {
sum += v
}
}
Expand Down
10 changes: 5 additions & 5 deletions go/euler/euler3.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"math"
)

func primes(limit uint64) (chan uint64){
func primes(limit uint64) chan uint64 {
arr := make([]bool, limit)
c := make(chan uint64)
go func () {
go func() {
for i := uint64(2); i < limit; i++ {
if arr[i] == false {
c <- i
for j := i*2; j < limit; j += i {
for j := i * 2; j < limit; j += i {
arr[j] = true
}
}
Expand All @@ -24,11 +24,11 @@ func primes(limit uint64) (chan uint64){

func main() {
number := uint64(600851475143)
pr := primes(uint64(math.Sqrt(float64(number)))+1)
pr := primes(uint64(math.Sqrt(float64(number))) + 1)

last := uint64(1)
for p := range pr {
if number % p == 0 {
if number%p == 0 {
last = p
}
}
Expand Down

0 comments on commit d08c743

Please sign in to comment.