Given an integer N, check whether the given number is a Curzon Number or not.
A number N is said to be a Curzon Number if 2N + 1 is divisible by 2*N + 1.
Input: N = 5
2^5 + 1 = 33 and 2*5 + 1 = 11
Since 11 divides 33, so 5 is a curzon number.
Input: N = 10
2^10 + 1 = 1025 and 2*10 + 1 = 21
1025 is not divisible by 21, so 10 is not a curzon number.
Approach: The approach is to compute and check if 2N + 1 is divisible by 2*N + 1 or not.
- First find the value of 2*N + 1
- Then find the value of 2N + 1
- Check if the second value is divisible by the first value, then it is a Curzon Number, else not.
Below is the implementation of the above approach:
Time complexity: O(log N)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Find ratio of zeroes, positive numbers and negative numbers in the Array
- Fill the missing numbers in the array of N natural numbers such that arr[i] not equal to i
- Count of N-digit Numbers having Sum of even and odd positioned digits divisible by given numbers
- Count of numbers upto M divisible by given Prime Numbers
- Print N lines of 4 numbers such that every pair among 4 numbers has a GCD K
- Check if a given pair of Numbers are Betrothed numbers or not
- Numbers less than N which are product of exactly two distinct prime numbers
- Count numbers which are divisible by all the numbers from 2 to 10
- Maximum sum of distinct numbers such that LCM of these numbers is N
- Count numbers which can be constructed using two numbers
- Absolute difference between the Product of Non-Prime numbers and Prime numbers of an Array
- Number of ways to obtain each numbers in range [1, b+c] by adding any two numbers in range [a, b] and [b, c]
- Absolute Difference between the Sum of Non-Prime numbers and Prime numbers of an Array
- Print numbers such that no two consecutive numbers are co-prime and every three consecutive numbers are co-prime
- Sum of first n even numbers
- D Numbers
- Self Numbers
- Add two numbers using ++ and/or --
- Second Pentagonal numbers
- Sum of first n odd numbers in O(1) Complexity
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.