1) Find all the 0 to 9 pandigital numbers (without leading zero) that
have the largest power of 3 as a factor.
2) One of these numbers has a very interesting property. What is it?
*an x to y pandigital number is an integer that contains all the digits from x to y and only those digits once each, for example 1234 is 1 to 4 pandigital but not 1 to 9 pandigital*
list - 900
10 N="1023456789"
20 while left(N,1)>"0"
30 V=val(N)
35 Pwr=0
40 while V@3=0
50 V=V//3:inc Pwr
60 wend
70 if Pwr>=Maxp then Maxp=Pwr:print N,Pwr
80 gosub *Permute(&N)
90 wend
900 end
OK
displays:
run
1023456789 4
1023458976 4
1023459786 4
1023459867 6
1023487569 7
1023489756 8
1025897643 9
1027865943 10
1029578364 11
1250834967 11
1257389406 12
1359426078 12
1742063598 12
2081654397 12
2095471863 12
2170936485 12
2304859617 12
2415930786 12
2419650873 12
2548791036 12
2934085761 12
3410256897 14
5361708249 14
5902183746 14
6820513794 14
7246198035 15
OK
These show the largest powers of 3 found up to that point (so once a 14th power is found, 12th powers are no longer shown).
The final power of 3 is 15, but only one pandigital has this power of 3 as a factor.
Those pandigitals with a factor of 3 to the 14th or 15th power are:
3410256897 14
5361708249 14
5902183746 14
6820513794 14
7246198035 15
8145396207 14
8269753401 14
9145036728 14
9537240186 14
|
Posted by Charlie
on 2009-02-24 12:36:51 |