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 21:09, 13 July 2021
, 2 years agoSmallest power of 6 whose decimal expansion contains n en FreeBASIC
(Added Go) |
(Smallest power of 6 whose decimal expansion contains n en FreeBASIC) |
||
Line 475:
21 216
</pre>
=={{header|FreeBASIC}}==
{{trans|Ring}}
<lang freebasic>
Print !"\ntrabajando...\n"
Print !"M¡nima potencia de 6 cuya expansi¢n decimal contiene n:\n"
Dim As Uinteger num = 0, limit = 200, m
For n As Ubyte = 0 To 21
Dim As String strn = Str(n)
For m = 0 To limit
Dim As String strpow = Str(6 ^ m)
Dim As Ulong ind = Instr(strpow,strn)
If ind > 0 Then
Print Using "##. 6^\\ = &"; n; Str(m); strpow
Exit For
End If
Next m
Next n
Print !"\n--- terminado, pulsa RETURN---"
Sleep
</lang>
=={{header|Go}}==
|