An Exploration of the "6174 Problem" and Some Generalizations

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

Given a four-digit number, rearrange the digits first in descending order and then in ascending order. Subtract the two numbers obtained to arrive at a new four-digit number. As an example, if the original number is 1025, the new number is 5210 - 0125 = 5085. When this procedure is iterated sufficiently many times, using any starting number that does not have all four digits equal, the result is the fixed point 6174. This Demonstration allows you to vary the number of digits and the base in which the number is represented. You can view the computations for a given starting number or plot the iterated values versus the original numbers for all numbers with a fixed number of digits.

Contributed by: Marc Brodie (Wheeling Jesuit University) (March 2011)
Inspired by: Robert Dumonceaux
Open content licensed under CC BY-NC-SA



Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.