13
votes
22answers
948 views

Sum of primes between given range

Write the shortest code for finding the sum of primes between a and b (inclusive). Input a and b can be taken from command line or stdin (space seperated) Assume 1 <= a <= b <= 108 ...
4
votes
4answers
472 views

Code-Challenge:The Nearest Prime

Challenge In this task you would be given an integer N you have to output the nearest prime to the integer. If the number is prime itself output the number. The input N is given in a single ...
2
votes
2answers
254 views

List prime-factorized natural numbers up to N in ascending order

For a given n list prime factorization of all natural numbers between 1 and n in ascending order. For example, for n = 10 the output would be: 1: 2: 2^1 3: 3^1 4: 2^2 5: 5^1 6: 2^1 3^1 7: 7^1 8: 2^3 ...