# Generating Numbers

Applying the steps below, you will generate a number, on the condition that every digit of a number produced in each step is different from its other digits.

1. Write down a number with one, two or three digits.
2. Delete at most three consecutive digits and in the places of the deleted digits place the square of the number formed by these digits.
3. For the number you get, repeat steps two and three. If you cannot get a number that satisfies the conditions, stop.

What is the largest number that can be generated through this mechanism?

Example: 307, 3(07), 349, 3(4)9, 3169, ...

Source: Puzzleup 2010

• Could the tag "computer-puzzle" be appropriate or is this really doable with logical deduction? Dec 17, 2017 at 18:20
• @A.P. well, you are free to find it by a computer, I am not sure whether if it is needed. not my original.
– Oray
Dec 17, 2017 at 18:29

As this didn't had a no-computers tag. I used a computer program.

38(7)
38(49)
(3)82401
98(24)01
98(5)7601
98(2)57601
98457(6)01
984(5)73601
9842573601

987

Remove 2 digits

98 and 98^2= 9604

The Number becomes

96047

Remove again 2 digits

96 and 96^2=9216

The Number becomes

9216047

Remove one digit

6 and 6^2=36

The Number becomes

92136047

The maximum number is

92136047

• 987 already has a 9. So is squaring 98 to get 9604 valid? Dec 17, 2017 at 18:41
• Look at the given example when you use the square of digits you replace them with the square
– yass
Dec 17, 2017 at 18:45
• I wrote a computer program instead. Manual calculation of this would have been impossible. Dec 17, 2017 at 18:48