Add julia solution and fasten bash solution for problem 10 #1
1 changed files with 5 additions and 3 deletions
|
@ -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"
|
||||||
|
|
Reference in a new issue