Company: Texas

Difficulty: medium

Problem Statement

First K Primes With a Given Digit Sum Given integers `N` and `K`, print the first `K` prime numbers below `100000` whose decimal digits sum to `N`. Input Format The first line contains `N`. The second line contains `K`. Output Format Print the selected primes in increasing order, separated by spaces. If fewer than `K` exist, print every matching prime. If none exist, print `-1`. Example Input: `10` then `5`. Output: `19 37 73 109 127`.

More Texas OA questionsInterview experiences