Add julia solution and fasten bash solution for problem 10 #1

Merged
felixcremer merged 4 commits from master into master 2017-10-17 01:29:23 +02:00
Showing only changes of commit f925e1c86c - Show all commits

View file

@ -1,10 +1,12 @@
#!/usr/bin/bash #!/bin/bash
# I have yet to see this script coming to an end... # I have yet to see this script coming to an end...
declare -i primeSum=0 declare -i primeSum=2
sequence=$(seq 3 2 2000000)
for num in {2..2000000}; do for num in $sequence; do
echo $num
[[ "$(factor $num | cut -d " " -f2)" != $num ]] || primeSum=$(( $primeSum + $num )) [[ "$(factor $num | cut -d " " -f2)" != $num ]] || primeSum=$(( $primeSum + $num ))
done done
echo "$primeSum" echo "$primeSum"