Skip to content

A Kaprekar number is one whose square can be divided into two parts, such that adding them together yields the original number. For example, the number 9 is a Kaprekar number, since 9^2 = 81, and 8 + 1 = 9.

Notifications You must be signed in to change notification settings

diegoperea20/Kaprekar-number

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Kaprekar number

A Kaprekar number is one whose square can be divided into two parts, such that adding them together yields the original number. For example, the number 9 is a Kaprekar number, since 9^2 = 81, and 8 + 1 = 9.

Write a Python function called solve that takes an integer as an argument and returns True if it is a Kaprekar number, and False otherwise. The function should check all possible divisions of the square of the number into two parts and check if their sum is equal to the original number. Make sure that the function avoids cases where the right hand side of the division is zero, as this would not meet the definition of a Kaprekar number.

About

A Kaprekar number is one whose square can be divided into two parts, such that adding them together yields the original number. For example, the number 9 is a Kaprekar number, since 9^2 = 81, and 8 + 1 = 9.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages