Given a positive integer n, the task is to print nth Hilbert Number.
Hilbert Number: In mathematics, A Hilbert Number is a positive integer of the form 4*n + 1 , Where n is a non-negative integer.
The first few Hilbert numbers are –
1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97
Input : 5 Output: 21 ( i.e 4*5 + 1 ) Input : 9 Output: 37 (i.e 4*9 + 1 )
- The n-th Hilbert Number of the sequence can be obtained by putting the value of n in the formula 4*n + 1.
Below is the implementation of the above idea:
- Hilbert Matrix
- Find minimum number to be divided to make a number a perfect square
- Count number of triplets with product equal to given number with duplicates allowed
- Count number of trailing zeros in Binary representation of a number using Bitset
- Smallest number dividing minimum number of elements in the Array
- Find the number of positive integers less than or equal to N that have an odd number of digits
- Largest number dividing maximum number of elements in the array
- Smallest number dividing minimum number of elements in the array | Set 2
- Number of ways to split a binary number such that every part is divisible by 2
- Given number of matches played, find number of teams in tournament
- Number of possible permutations when absolute difference between number of elements to the right and left are given
- Number of times the largest perfect square number can be subtracted from N
- Count number of digits after decimal on dividing a number
- Find the smallest number whose digits multiply to a given number n
- Find the total number of composite factor for a given number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.