A Cullen Number is a number of the form is 2n * n + 1 where n is an integer. The first few Cullen numbers are 1, 3, 9, 25, 65, 161, 385, 897, 2049, 4609 . . . . . .
Input : n = 4 Output :65 Input : n = 0 Output : 1 Input : n = 6 Output : 161
Below is implementation of formula. We use bitwise left-shift operator to find 2n, then multiply the result with n and finally returns (1 << n)*n + 1.
Properties of Cullen Numbers:
- Most of the Cullen Numbers are composite numbers.
- n’th Cullen number is divisible by p = 2n – 1 if p is a prime number of the form 8k – 3.
This article is contributed by DANISH_RAZA. 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 write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
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.
- Program to find last digit of n'th Fibonnaci Number
- C program to find Decagonal Number
- Program to find Star number
- Puzzle | Program to find number of squares in a chessboard
- Program to find remainder when large number is divided by 11
- Program to find last two digits of Nth Fibonacci number
- Program to find the number of region in Planar Graph
- Program to find number of solutions in Quadratic Equation
- Program to find the nth Kynea number
- Program to find total number of edges in a Complete Graph
- Program to find the Hidden Number
- Program to find the Nth Harmonic Number
- Program to find remainder when large number is divided by r
- Program to find minimum number of lectures to attend to maintain 75%
- Program to find the Nth number of the series 2, 10, 24, 44, 70.....
- Program to find count of numbers having odd number of divisors in given range
- Program to find the number of men initially
- Program to find the Nth Prime Number
- Program to find the next prime number
- Program to find the number from given holes
Improved By : jit_t