You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
369 B

package main
import (
"fmt"
"os"
"strconv"
"lib/is"
)
func main() {
if len(os.Args) != 2 {
fmt.Println("0")
} else {
argument, _ := strconv.Atoi(os.Args[1])
if argument < 0 {
fmt.Println("0")
} else {
result := 0
for ; argument >= 0; argument-- {
if is.Prime(argument) {
result += argument
}
}
fmt.Println(result)
}
}
}