Smallest numbers: Difference between revisions
Content added Content deleted
(add FreeBASIC) |
(Realize in F#) |
||
Line 45: | Line 45: | ||
</pre> |
</pre> |
||
=={{header|F_Sharp|F#}}== |
|||
<lang fsharp> |
|||
// Smallest number: Nigel Galloway. April 13th., 2021 |
|||
let rec fG n g=match bigint.DivRem(n,if g<10 then 10I else 100I) with (_,n) when (int n)=g->true |(n,_) when n=0I->false |(n,_)->fG n g |
|||
{0..50}|>Seq.iter(fun g->printf "%d " (1+({1..0x0FFFFFFF}|>Seq.map(fun n->(bigint n)**n)|>Seq.findIndex(fun n->fG n g)))); printfn "" |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
9 1 3 5 2 4 4 3 7 9 26 11 14 21 22 26 8 25 16 19 23 21 13 25 17 5 25 3 11 18 27 5 23 24 22 7 17 16 21 19 18 17 9 7 12 28 18 23 27 24 23 |
|||
Real: 00:00:00.005 |
|||
</pre> |
|||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
{{works with|Factor|0.99 2021-02-05}} |
{{works with|Factor|0.99 2021-02-05}} |