Ответ 18662
Реализация на Haskell
divisors n = [x | x <- [1..(n - 1)], rem n x == 0]<br>primes = [n | n <- [1..], isPrime n] where isPrime x = (divisors x == [1])<br>prime = last $ take (11+1) primes
calc :: Integer->Integer->Integer
calc x sm | x>100000 = sm
calc x sm | (x `mod` 2 /= 0 &&
x `mod` 3 /= 0 &&
x `mod` 5 /= 0 &&
x `mod` 7 /= 0 &&
x `mod` 11 /= 0 &&
x `mod` 13 /= 0 &&
x `mod` prime /= 0) = calc (x+1) (sm+1)
| otherwise = calc (x+1) sm
main :: IO ()
main = putStrLn $ show $ calc 1 0