Find an example of a non trivial Think of a number game Everyone knows the game where someone ask you to think of a positive integer, then ask you to do some elementary mental operations and finally predict the result.
Example: think of a number $n$, double it, add $6$, half the result, take out yournumber $n$, you get $3$. A "think of a number game" can be represented by a function $f:A \subset \mathbb{N}\rightarrow \mathbb{N}$, where $A$ is the set from which we are allowed to choose our number, such that $f(n)=a$ for every $n\in A$. $a$ is the constant result that can be predicted. A last important requirment on $f$ is that it must be computable by mental calculation, or at least by hand. In my example 
$$f(n)=\frac{2n+6}{2}-n=3=a.$$
My question is : can you give me an example of a non trivial "think of a number game"? In other words an example of a function $f$, as defined before, constant on a set $A$ such that it's not trivial that $f$ is constant at first sight. 
A less trivial example could be given $n$, add together the digits of $9n$, add again the digits of the result and repeat until you get a single digit number, the result will be always $9$; but I think that this is still a quite trivial example.
 A: Take a $4$-digit number, such that not all digits are equal. Sort the digits ascending and descending and subtract the smaller from the larger number. Repeat this process until the previous number repeats in the sequence.
Example : $2781$ -> $8721-1278=7443$ -> $7443-3447=3996$ -> $9963-3699=6264$ -> $6642-2466=4176$ -> $7641-1467=6174$ -> $7641-1467=6174$
The result will always be $6174$.
Remark : If the number contains zeros, for example $5008$ , one of the numbers has less than four digits (here , we subtract $8500-58$)
A: okay The special number here is $1089$ . take a three digit number whose digits are distinct from each other ill give example and then proof.. e g $123$ reverse digits you get $321$ subtract smallest three digit number formed by these digits. $321-123=198$  reverse it $891$ and add both you get $891+198=1089$. $PROOF$: let the number be XYZ X is hunderth place,Y is tenth and Z is unit place. reverse it ZYX.  subtract both but uniquely subtract $ 1$ hundreds from X, add $9$ tens to tenth and add $10$ tens to unit place. so subtracting hundreds tens and units place indivdually $(X-1)-Z,Y+9-Y=9,Z+10-X$ now the last step reversing this new number $[(X-1)-Z][9][Z+10-X]$ which is $[10+Z-X][9][X-1-Z]$. adding them and simplifying we get $1089$!. NOTE;'[]' indicates a digit as if written continuously looks complicated. Hope this example helps you.
