Segmented Prime Check & Loop-Else Sieve Summary
Difficulty: Medium · Unit 2: Control Flow, Scope & Recursion · Featured in: CodeTantra Lab Pattern
Given two integers L and R (1 <= L <= R <= 10^5), find the count of prime numbers in [L, R] inclusive and the sum of all composite numbers in [L, R] (note: 1 is neither prime nor composite).
Input & Output Format
Input: A single line with two integers L and R.
Output: Print two space-separated integers: <prime_count> <composite_sum>.
Sample 1
1 10
4 37
Primes: 2,3,5,7 (count=4). Composites: 4+6+8+9+10 = 37. Note 1 is excluded from both.
Free forever — sign in with email at poorvithmp.com to unlock the dry run, verified Python 3 solution, edge-case traps, and downloads.