We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Modified Kaprekar Numbers
Modified Kaprekar Numbers
Sort by
recency
|
1037 Discussions
|
Please Login in order to post a comment
Here is my c++ solution, you can what the explanation here : https://youtu.be/MttrQCHGu3w
Hi, this is my solution in C# 🐿️
Solution of Kaprekar Numbers in Python :
def kaprekarNumbers(p, q): arr = [] if p == 1: arr.append(1) start = p if p >= 9 else 9 for i in range(start, q+1): left = str(i**2)[:-len(str(i))] right = str(i**2)[-len(str(i)):] if int(left) + int(right) == i: arr.append(i) print(*arr) if arr else print("INVALID RANGE")