Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

Modified Kaprekar Numbers (Python) #281

Closed
nazuk27 opened this issue Oct 25, 2020 · 2 comments
Closed

Modified Kaprekar Numbers (Python) #281

nazuk27 opened this issue Oct 25, 2020 · 2 comments

Comments

@nazuk27
Copy link
Contributor

nazuk27 commented Oct 25, 2020

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.

@nazuk27
Copy link
Contributor Author

nazuk27 commented Oct 25, 2020

@aditya109 Please assign this issue to me. Thanks!

@aditya109
Copy link
Owner

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.

@aditya109 aditya109 added this to the HacktoberFest Last Date milestone Oct 26, 2020
nazuk27 added a commit to nazuk27/git-osp-for-beginners that referenced this issue Oct 26, 2020
Signed-off-by: Nazish Khan <nazish1771@gmail.com>
nazuk27 added a commit to nazuk27/git-osp-for-beginners that referenced this issue Oct 26, 2020
Added Modified Kaprekar Numbers (Python) aditya109#281
aditya109 pushed a commit that referenced this issue Oct 28, 2020
* Added Counting occurrence of each word (Python) #276

Signed-off-by: Nazish Khan <nazish1771@gmail.com>

* Added Counting occurrence of each word (Python) in proper folder

* Added Reverse a doubly linked list (Python) #283

Signed-off-by: Nazish Khan <nazish1771@gmail.com>

* Delete CountingOccurrenceOfEachWord.py

* Delete ReverseDoublyLinkedList.py

* Added Reverse a doubly linked list (Python) #283

Signed-off-by: Nazish Khan <nazish1771@gmail.com>

* Added Modified Kaprekar Numbers (Python) #281

Signed-off-by: Nazish Khan <nazish1771@gmail.com>
aditya109 pushed a commit that referenced this issue Oct 28, 2020
* Added Counting occurrence of each word (Python) #276

Signed-off-by: Nazish Khan <nazish1771@gmail.com>

* Added Counting occurrence of each word (Python) in proper folder

* Added Reverse a doubly linked list (Python) #283

Signed-off-by: Nazish Khan <nazish1771@gmail.com>

* Delete CountingOccurrenceOfEachWord.py

* Delete ReverseDoublyLinkedList.py

* Added Reverse a doubly linked list (Python) #283

Signed-off-by: Nazish Khan <nazish1771@gmail.com>

* Added Modified Kaprekar Numbers (Python) #281

Signed-off-by: Nazish Khan <nazish1771@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants