Skip to content

Add Kaprekar's Constant (6174) Algorithm to Special Numbers - #13862

Merged
cclauss merged 1 commit into
TheAlgorithms:masterfrom
xingarr:feature/add-kaprekar-constant-algorithm
Sep 5, 2026
Merged

Add Kaprekar's Constant (6174) Algorithm to Special Numbers#13862
cclauss merged 1 commit into
TheAlgorithms:masterfrom
xingarr:feature/add-kaprekar-constant-algorithm

Conversation

@xingarr

Copy link
Copy Markdown
Contributor

Description

This PR adds an implementation of Kaprekar's Constant (6174) algorithm to the maths/special_numbers directory.

What is Kaprekar's Constant?

Kaprekar's Constant is a fascinating mathematical property discovered by Indian mathematician D. R. Kaprekar in 1949. When you:

  1. Take any 4-digit number with at least two different digits
  2. Arrange digits in descending order (largest number)
  3. Arrange digits in ascending order (smallest number)
  4. Subtract smaller from larger
  5. Repeat with the result

@cclausscclauss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cclauss
cclauss merged commit dfc6e77 into TheAlgorithms:masterSep 5, 2026
5 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@xingarr@cclauss