Smallest power of 6 whose decimal expansion contains n: Difference between revisions
Smallest power of 6 whose decimal expansion contains n (view source)
Revision as of 22:42, 9 April 2021
, 3 years agoAdd Python
Not a robot (talk | contribs) (Add C++) |
Not a robot (talk | contribs) (Add Python) |
||
Line 651:
</pre>
A limit of 10,000,000 takes 1 min 41s, reaches 6^21,798 which has 16,963 digits (not including commas) and is the first to contain 8091358, at offset 13,569.
=={{header|Python}}==
<lang python>def smallest_six(n):
p = 1
while str(n) not in str(p): p *= 6
return p
for n in range(22):
print("{:2}: {}".format(n, smallest_six(n))</lang>
{{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</pre>
=={{header|Raku}}==
|