In number theory, a Leyland number is a number of the form xy + yx, where x and y are integers greater than 1 and 1 <y <= x.
Given a positive integer N. The task is to print first N Leyland number in ascending order. The first few Leyland numbers are 8, 17, 32, 54, 57, 100, …
Input : N = 1 Output : 8 22 + 22 = 4 + 4 = 8. Input : N = 6 Output : 100
The idea to run two loop, one for x and other for y. The outer loop start with 2 to n and for each iteration of outer loop, run inner loop start from 2 t x. And store xy + yx in an array. After calculating all the value sort them and print first n numbers.
Below is the implementation of this approach:
8 17 32 54 57 100
- Count number of triplets with product equal to given number with duplicates allowed
- Find minimum number to be divided to make a number a perfect square
- Count number of trailing zeros in Binary representation of a number using Bitset
- Given number of matches played, find number of teams in tournament
- Smallest number dividing minimum number of elements in the Array
- Number of times the largest perfect square number can be subtracted from N
- Smallest number dividing minimum number of elements in the array | Set 2
- Number of possible permutations when absolute difference between number of elements to the right and left are given
- 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
- Number of ways to split a binary number such that every part is divisible by 2
- Build Lowest Number by Removing n digits from a given number
- Find the number of ways to divide number into four parts such that a = c and b = d
- Find the total number of composite factor for a given number
- Count number of ways to divide a number in 4 parts
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.