Smallest power of 6 whose decimal expansion contains n: Difference between revisions
Content added Content deleted
(→{{header|Ruby}}: Add Ruby) |
(Added Quackery.) |
||
Line 1,350: | Line 1,350: | ||
20: 170581728179578208256 |
20: 170581728179578208256 |
||
21: 216</pre> |
21: 216</pre> |
||
=={{header|Quackery}}== |
|||
<syntaxhighlight lang="Quackery"> [ dip 1+ |
|||
10 / |
|||
dup 0 = until ] |
|||
drop ] is digitcount ( n --> n ) |
|||
[ 10 over digitcount |
|||
** temp put |
|||
false unrot |
|||
[ over temp share mod |
|||
over = iff |
|||
[ rot not unrot ] |
|||
done |
|||
dip [ 10 / ] |
|||
over 0 = until ] |
|||
2drop |
|||
temp release ] is contains ( n n --> b ) |
|||
[ -1 swap |
|||
[ dip 1+ |
|||
over 6 swap ** |
|||
over contains |
|||
until ] |
|||
drop ] is smallest ( n --> n ) |
|||
22 times |
|||
[ i^ 10 < if sp |
|||
i^ echo |
|||
say " --> " |
|||
6 i^ smallest ** |
|||
echo cr ] |
|||
cr |
|||
say "The smallest power of 6 whose decimal expansion contains 31415926 is 6^" |
|||
31415926 smallest echo say "." cr</syntaxhighlight> |
|||
{{out}} |
|||
<pre> 0 --> 10077696 |
|||
1 --> 1 |
|||
2 --> 216 |
|||
3 --> 36 |
|||
4 --> 46656 |
|||
5 --> 46656 |
|||
6 --> 6 |
|||
7 --> 7776 |
|||
8 --> 2176782336 |
|||
9 --> 1296 |
|||
10 --> 10077696 |
|||
11 --> 2821109907456 |
|||
12 --> 1296 |
|||
13 --> 13060694016 |
|||
14 --> 6140942214464815497216 |
|||
15 --> 101559956668416 |
|||
16 --> 216 |
|||
17 --> 60466176 |
|||
18 --> 470184984576 |
|||
19 --> 21936950640377856 |
|||
20 --> 170581728179578208256 |
|||
21 --> 216 |
|||
The smallest power of 6 whose decimal expansion contains 31415926 is 6^4261.</pre> |
|||
=={{header|Raku}}== |
=={{header|Raku}}== |