Counting numbers like 1, 2, 3, 4, 5, 6 … Basically, all integers greater than 0 are natural numbers.
👁 Image
Facts about Natural numbers
- The natural numbers are the ordinary numbers, 1, 2, 3, etc., with which we count.
- The next possible natural number can be found by adding 1 to the current natural number
- The number zero is sometimes considered to be a natural number. Not always because no one counts starting with zero, 0, 1, 2, 3.
- GCD of all other natural numbers with a prime is always one.
- The natural numbers can be defined formally by relating them to sets. Then, zero is the number of elements in the empty set; 1 is the number of elements in the set containing one natural number; and so on.
Iterative Approach
Output1 2 3 4 5 6 7 8 9 10
Time Complexity: O(n)
Auxiliary Space: O(1)
Recursive Approach
Output1 2 3 4 5 6 7 8 9 10
Time Complexity: O(n)
Auxiliary Space: O(n)
More problems related to Natural Number: