All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 1 to 9 concatenation (Posted on 2016-04-12)
What is the largest number n so that n, 2n, and 3n together contain every digit from 1-9 exactly once?

Analytical solution preferred.

 No Solution Yet Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 6 of 7 |
n     2n   3n
192 384 576
219 438 657
273 546 819
327 654 981
1902 3804 5706
1920 3840 5760
2019 4038 6057
2190 4380 6570
2703 5406 8109
2730 5460 8190
3027 6054 9081
3270 6540 9810
19002 38004 57006
19020 38040 57060
19200 38400 57600
20019 40038 60057
20190 40380 60570
21900 43800 65700
27003 54006 81009
27030 54060 81090
27300 54600 81900
30027 60054 90081
30270 60540 90810
32700 65400 98100

By allowing any zeroes it could go on forever. Otherwise it stops at 327 654 981.

DefDbl A-Z
Dim crlf\$, digct()

Form1.Visible = True

Text1.Text = ""
crlf = Chr\$(13) + Chr\$(10)

For n = 10 To 99999
ReDim digct(9)
n2 = 2 * n: n3 = 3 * n
tst\$ = LTrim(Str(n)) + LTrim(Str(n2)) + LTrim(Str(n3))
good = 1
For i = 1 To Len(tst\$)
s = Val(Mid(tst, i, 1))
digct(s) = digct(s) + 1
If digct(s) > 1 And s > 0 Then good = 0: Exit For
Next
If good Then
For i = 1 To 9
If digct(i) = 0 Then good = 0: Exit For
Next
If good Then
Text1.Text = Text1.Text & n & Str(n2) & Str(n3) & crlf
End If
End If
Next n

Text1.Text = Text1.Text & crlf & " done"

End Sub

 Posted by Charlie on 2016-04-12 14:58:24

 Search: Search body:
Forums (0)