Prime Time Again Problem Statement
You are given two integers DAY_HOURS
and PARTS
. Consider a day with DAY_HOURS
hours, which can be divided into PARTS
equal parts. Your task is to determine the total instances of equivalent prime groups, where a prime group is defined as a set of hour values that are prime and occur at the same position in different parts of the day.
Example:
Input:
DAY_HOURS = 20
PARTS = 2
Output:
2
Explanation:
If we divide the day into 2 parts, we have:
Part 1: 1 2 3 4 5 6 7 8 9 10
Part 2: 11 12 13 14 15 16 17 18 19 20
3-13
is a prime group, as both numbers are prime.7-17
is a prime group, as both numbers are prime.
There are 2 prime groups in total.
Constraints:
1 <= T <= 100
10 <= DAY_HOURS <= 5 * 10^3
2 <= PARTS <= 10^3
- Time Limit: 1 second
Input:
The first line of input contains an integerT
representing the number of test cases.
The first and only line of each test case contains two space-separated integersDAY_HOURS
andPARTS
.
Output:
Output a single integer for each test case, representing the number of equivalent prime groups.
Note:
- The day starts with hour 1 and ends with hour
DAY_HOURS
. - Each hour in a prime group must be in a different part of the day.
- If there is no prime group, return zero.
DAY_HOURS
should be divisible byPARTS
.

AnswerBot
4mo
Calculate total instances of equivalent prime groups in a day divided into equal parts.
Divide the day into equal parts and check for prime groups at the same position in different parts.
Each prime gro...read more
Help your peers!
Add answer anonymously...
TCS Assistant System Engineer interview questions & answers
An Assistant System Engineer was asked 1mo agoQ. What is the difference between an array and an ArrayList?
An Assistant System Engineer was asked 1mo agoQ. What is an API?
An Assistant System Engineer was asked 3mo agoQ. Explain your graduation project in detail.
Popular interview questions of Assistant System Engineer
An Assistant System Engineer was asked 1mo agoQ1. What is the difference between an array and an ArrayList?
An Assistant System Engineer was asked 1mo agoQ2. What is an API?
An Assistant System Engineer was asked 3mo agoQ3. Explain your graduation project in detail.
Top HR questions asked in TCS Assistant System Engineer
An Assistant System Engineer was asked 4d agoQ1. Where do you want to see yourself in 5 years?
An Assistant System Engineer was asked 3w agoQ2. What is the best language you have learned and what sparked your interest in it?
An Assistant System Engineer was asked 3w agoQ3. What was your major project?
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

