An undulating number is a number that has only two types of digits and alternate digits are same, i.e., it is of the form “ababab….”. It is sometimes restricted to non-trivial undulating numbers which are required to have at least 3 digits and a is not equal to b.
The first few such numbers are: 101, 121, 131, 141, 151, 161, 171, 181, 191, 202, 212, 232, 242, 252, 262, 272, 282, 292, 303, 313, 323, 343, 353, 363, 373, 383, 393, 404, 414, 424, 434, 454, 464, 474, 484, 494, …
Some higher undulating numbers are: 6363, 80808, 1717171.
- For any n >= 3, there are 9 × 9 = 81 non-trivial n-digit undulating numbers, since the first digit can have 9 values (it cannot be 0), and the second digit can have 9 values when it must be different from the first.
Given a number, check if it is Undulating numbers considering the definition of alternating digits, at least 3 digits and adjacent digits not same.
Input : n = 121 Output : Yes Input : n = 1991 Output : No
- Print N lines of 4 numbers such that every pair among 4 numbers has a GCD K
- Numbers less than N which are product of exactly two distinct prime numbers
- Maximum sum of distinct numbers such that LCM of these numbers is N
- Count numbers which are divisible by all the numbers from 2 to 10
- Count numbers which can be constructed using two numbers
- Absolute difference between the Product of Non-Prime numbers and Prime numbers of an Array
- 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
- Add two numbers using ++ and/or --
- Sum of cubes of first n even numbers
- Dudeney Numbers
- Numbers with exactly 3 divisors
- Given two numbers a and b find all x such that a % x = b
- Prime Numbers
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.
Improved By : jit_t