Sum of prime numbers in a range
Kotlin
Medium
math
Task «Sum of prime numbers in a range»
Write a program that finds the sum of all prime numbers in a given range [a, b] inclusive. A prime number is a natural number greater than 1 that is divisible only by 1 and itself. If there are no prime numbers in the range, output 0. It is guaranteed that a and b are integers, 1 ≤ a ≤ b ≤ 10^6.
Input Format
Two integers a and b, separated by a space.
Output Format
One integer — the sum of prime numbers in the range [a, b].
main.kt