4321 − 1234 = 3087, then 8730 − 0378 = 8352, and How to swap two numbers without using a temporary variable? Now how about making Kaprekar music. This number is special as we always get this number when following steps are followed for any four digit number such that all digits of number are not same, i.e., all four digit numbers excluding (0000, 1111, …). Sort four digits in ascending order and store result in a number “asc”. Subtract number larger number from smaller number, i.e., abs(asc – desc). : kaprekar ( +n - +n1) dup square >r base @ swap He showed that 6174 is reached in the limit as one repeatedly subtracts the highest and lowest numbers that can be constructed from a set of four digits that are not all identical. Repeat above three steps until the result of subtraction doesn’t become equal to the previous number. Let’s try with another number- How about this year as four digit number- 2014 There can be analogous fixed points for digit lengths other than four, for instance if we use 3-digit numbers then most sequences (i.e., other than repdigits such as 111) will terminate in the value 495 in at most 6 iterations. He had no formal postgraduate training and worked as a schoolteacher in Nasik, India. Sometimes these numbers (495, 6174, and their counterparts in other digit lengths or in bases other than 10) are called "Kaprekar constants". Following is the program to demonstrate the same. This article is contributed by Gaurav Saxena. Kaprekar number is one of those gems, that makes Mathematics fun. brightness_4 Write Interview D. R. Kaprekar. In 1949 the mathematician D. R. Kaprekar from Devlali, India, devised a process now known as Kaprekar’s operation. Start with any four digit number, with no repeating digits – say Z. code, Reference: 6174 is known as Kaprekar's constant as it was invented by Indian mathematician DR Kaprekar in 1949. edit By using our site, you See your article appearing on the GeeksforGeeks main page and help other Geeks. His claim to fame is the Kaprekar constant 6174. Download JAR : This page was last edited on 20 November 2020, at 17:36. 6174 is the Kaprekar Constant. \ Return nonzero if n is a Kaprekar number for tens, where tens is a \ nonzero power of base. [4] Once 6174 is reached, the process will continue yielding 7641 – 1467 = 6174. Perhaps the best known of Kaprekar's results is the following which relates to the number 6174, today called Kaprekar's constant. A Kaprekar number is a number whose square when divided into two parts and such that sum of parts is equal to the original number and none of the parts has value 0. Despite having no formal postgraduate training and working as a schoolteacher, he published extensively and became well … Let us look at some of the ideas which he introduced. Dattathreya Ramchandra Kaprekar (1905–1986) was an Indian recreational mathematician who described several classes of natural numbers including the Kaprekar, Harshad and Self numbers and discovered the Kaprekar constant, named after him. Subtract the smaller number from the bigger number. Please use ide.geeksforgeeks.org, generate link and share the link here. Take any four-digit number, using at least two different digits (leading zeros are allowed). There are some wonderful attempts to convert the digits of mathematical constant Pi to musical sequence [check Michael John Blake- A musical interpretation of pi, and Lucy Kaplansky - Song About Pi].The major scale consists of 7 notes from any chromatic scale and we have already seen that the Kaprekar constant can be reached at the most 7 … Indian recreational mathematician D.R.Kaprekar, found number 6174 – also known as Kaprekar constant – that will return the subtraction result when following this rules: Take any four-digit number, with minimum of two different numbers (1122 or 5151 or 1001 or 4375 and so on.) Experience. Kaprekar constant. Kaprekar phenomena 3 2.5 Kaprekar constants We say that (B,D)is Kaprekar tuple (showing Kaprekar phenomena), with Kaprekar constant K(B,D) ∈ FP(B,D), if every element n ∈ S is mapped to K(B,D)after some number of iterations of κ. 6174 is the Kaprekar Constant. 6174 is known as Kaprekar's constant after the Indian mathematician D. R. Kaprekar. Attention reader! All other four-digit numbers eventually reach 6174 if leading zeros are used to keep the number of digits at 4. ( tens n n^2 - t) rot /mod over >r + = r> and ; \ If n is a Kaprekar number, return is the power of base for which it \ is Kaprekar. For example, choose 1495: The only four-digit numbers for which Kaprekar's routine does not reach 6174 are repdigits such as 1111, which give the result 0000 after a single iteration. This 6174 number is known as Kaprekar constant. Born on January 17, 1905, at Dahanu near Mumbai, Kaprekar was an Indian mathematician who described several classes of natural numbers including the Kaprekar, Harshad and Self numbers and discovered the Kaprekar constant, named after him. His claim to fame is the Kaprekar constant 6174. The number 6174 is the first Kaprekar's constant to be discovered, and thus is sometimes known as Kaprekar's constant. Let A and B be two numbers formed by rearranging the digits of Z, such that A is the highest number that is possible, … Thus, starting with 1234, we have . Kaprekar's routine § Definition and properties, Sample (Perl) code to walk any four-digit number to Kaprekar's Constant, Sample (Python) code to walk any four-digit number to Kaprekar's Constant, https://www.dropbox.com/s/wsdo8766w01rdha/NumberSystemMagic.jar?dl=0, https://en.wikipedia.org/w/index.php?title=6174_(number)&oldid=989725041, Creative Commons Attribution-ShareAlike License. Then rearrange the digits to … Sort four digits in descending order and store result in a number “desc”. We define the Kaprekar function for base > and power > ,: → to be the following: F p , b ( n ) = α + β {\displaystyle F_{p,b}(n)=\alpha +\beta } , where β = n 2 mod b … This number is notable for the following rule: Arrange the digits in descending and then in ascending order to get two four-digit numbers, adding leading zeros if necessary. When we reach the number 6174, the operation repeats itself, returning 6174 every time. Please write to us at contribute@geeksforgeeks.org to report any issue with the above content. https://en.wikipedia.org/wiki/6174_(number). We use cookies to ensure you have the best browsing experience on our website. close, link 6174 is known as Kaprekar’s constant after the Indian mathematician D. R. Kaprekar. Don’t stop learning now. : is-kaprekar? acknowledge that you have read and understood our, GATE CS Original Papers and Official Keys, ISRO CS Original Papers and Official Keys, ISRO CS Syllabus for Scientist/Engineer Exam, Check the divisibility of Hexadecimal numbers, Count numbers less than N containing digits from the given set : Digit DP, Count of integers of length N and value less than K such that they contain digits only from the given set, Rearrange an array so that arr[i] becomes arr[arr[i]] with O(1) extra space, Rearrange an array such that ‘arr[j]’ becomes ‘i’ if ‘arr[i]’ is ‘j’ | Set 1, Rearrange an array in maximum minimum form | Set 1, Rearrange an array in maximum minimum form | Set 2 (O(1) extra space), Find number of pairs (x, y) in an array such that x^y > y^x, Count smaller elements on right side using Set in C++ STL, Count smaller elements on right side and greater elements on left side using Binary Index Tree, Count inversions in an array | Set 3 (Using BIT), Count Inversions in an array | Set 1 (Using Merge Sort), Fibonacci Heap – Deletion, Extract min and Decrease key, Write a program to print all permutations of a given string, Set in C++ Standard Template Library (STL), https://en.wikipedia.org/wiki/6174_(number), Find Index of given fibonacci number in constant time, Percentage increase in the cylinder if the height is increased by given percentage but radius remains constant, Maximize the first element of the array such that average remains constant, Count numbers from given range having odd digits at odd places and even digits at even places, Modify given array by reducing each element by its next smaller element, Farthest index that can be reached from the Kth index of given array by given operations, Check if given polygon is a convex polygon or not, Split array into equal length subsets with maximum sum of Kth largest element of each subset, Print all possible K-length subsequences of first N natural numbers with sum N, Minimize given flips required to reduce N to 0, Minimize difference between maximum and minimum array elements by exactly K removals, Split squares of first N natural numbers into two sets with minimum absolute difference of their sums, Bakhshali Approximation for computing square roots, Efficient program to print all prime factors of a given number, Program to find GCD or HCF of two numbers, Modulo Operator (%) in C/C++ with Examples.