Smallest power of 6 whose decimal expansion contains n: Difference between revisions
Content added Content deleted
m (→{{header|Free Pascal}}: using a seperate array for used numbers increases speed. 14 -> 9.1 secs) |
m (→{{header|Free Pascal}}: Commatize was a huge time factor) |
||
Line 912: | Line 912: | ||
=={{header|Pascal}}== |
=={{header|Pascal}}== |
||
==={{header|Free Pascal}}=== |
==={{header|Free Pascal}}=== |
||
Doing long multiplikation like in primorial task.<BR>I used to check every numberstring one after the other on one 6^ n string.Gets really slow on high n<BR>After a closer look into [[Phix|Smallest_power_of_6_whose_decimal_expansion_contains_n#Phix]] I applied a slghtly modified version of Pete |
Doing long multiplikation like in primorial task.<BR>I used to check every numberstring one after the other on one 6^ n string.Gets really slow on high n<BR>After a closer look into [[Phix|Smallest_power_of_6_whose_decimal_expansion_contains_n#Phix]] I applied a slghtly modified version of Pete. |
||
Removed Commatize in string assignment.Saves much time.But converting all afterwards consumes even more. |
|||
<syntaxhighlight lang="pascal">program PotOf6; |
<syntaxhighlight lang="pascal">program PotOf6; |
||
//First occurence of a numberstring with max decimal DIGTIS digits in 6^n |
//First occurence of a numberstring with max decimal DIGTIS digits in 6^n |