Change parity
Practice
4.5 (2 votes)
Binary search algorithm
Mathamatics
Basic math
Easy
Mathematics
Mathematics
Problem
83% Success 445 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Let \( P(X)\) be the parity of a number which is defined as N, where N is the number of integers that divide X.
You are given a number X and you have to determine the smallest number Y such that Y > X and \( P(Y) != P(X)\).

Input format

  • First line: T (number of test cases)
  • For each test case: X

Output format
For each test case, print the required answer on a separate line.

Constraints
\(1 \le T \le 10^{5} \)
\(1 \le X \le 10^8 \)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
6 votes
Tags:
ApprovedData StructuresEasyImplementationMerge sortSimulationSortingapproved
Points:30
14 votes
Tags:
AlgorithmsApprovedMathMediumOpen
Points:20
12 votes
Tags:
Ad-HocEasyString Manipulationapproved