You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.
A modified Kaprekar number is a positive whole number with a special property. If you square it, then split the number into two integers and sum those integers, you have the same value you started with.
For example, if n(number)=5, d(digits)=1 then n^2=25. We split that into two strings and convert them back to integers 2 and 5. We test 2+5 = 7 but not equal to 5, so this is not a modified Kaprekar number. If n=9, still d=1, and n^2=81. This gives us 1+8=9, the original n.
Input Format:
The first line contains the lower integer limit p.
The second line contains the upper integer limit q.
Note: Your range should be inclusive of the limits.
Constraints:
0<p<q<100000
Output Format:
Output each modified Kaprekar number in the given range, space-separated on a single line. If no modified Kaprekar numbers exist in the given range, print INVALID RANGE.
Sample Input:
1
100
Sample Output:
1 9 45 55 99
Explanation:
1, 9, 45, 55 and 99 are the Kaprekar Numbers in the given range.
The text was updated successfully, but these errors were encountered:
Hi @nazuk27 ! Please go on ahead and raise a PR for the same, linking this issue. I am assigning this issue to you. Please consider starring the repo, if you have not already to encourage further contributions.
A modified Kaprekar number is a positive whole number with a special property. If you square it, then split the number into two integers and sum those integers, you have the same value you started with.
For example, if n(number)=5, d(digits)=1 then n^2=25. We split that into two strings and convert them back to integers 2 and 5. We test 2+5 = 7 but not equal to 5, so this is not a modified Kaprekar number. If n=9, still d=1, and n^2=81. This gives us 1+8=9, the original n.
Input Format:
The first line contains the lower integer limit p.
The second line contains the upper integer limit q.
Note: Your range should be inclusive of the limits.
Constraints:
0<p<q<100000
Output Format:
Output each modified Kaprekar number in the given range, space-separated on a single line. If no modified Kaprekar numbers exist in the given range, print INVALID RANGE.
Sample Input:
1
100
Sample Output:
1 9 45 55 99
Explanation:
1, 9, 45, 55 and 99 are the Kaprekar Numbers in the given range.
The text was updated successfully, but these errors were encountered: