Jump to content

Smallest power of 6 whose decimal expansion contains n: Difference between revisions

Realize in F#
m (→‎{{header|Pascal}}: changed generating of strings.)
(Realize in F#)
Line 7:
 
 
=={{header|F_Sharp|F#}}==
<lang fsharp>
// Nigel Galloway. April 9th., 2021
let rec fN i g e l=match l%i=g,l/10I with (true,_)->e |(_,l) when l=0I->fN i g (e*6I) (e*6I) |(_,l)->fN i g e l
[0I..99I]|>Seq.iter(fun n->printfn "%2d %A" (int n)(fN(if n>9I then 100I else 10I) n 1I 1I))
</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
22 131621703842267136
23 2176782336
24 1023490369077469249536
25 170581728179578208256
26 16926659444736
27 279936
28 2821109907456
29 1296
30 13060694016
31 131621703842267136
32 4738381338321616896
33 2176782336
34 1023490369077469249536
35 609359740010496
36 36
37 21936950640377856
38 131621703842267136
39 221073919720733357899776
40 13060694016
41 78364164096
42 131621703842267136
43 28430288029929701376
44 16926659444736
45 470184984576
46 46656
47 470184984576
48 6140942214464815497216
49 470184984576
50 21936950640377856
51 1326443518324400147398656
52 623673825204293256669089197883129856
53 789730223053602816
54 6140942214464815497216
55 101559956668416
56 46656
57 470184984576
58 3656158440062976
59 16926659444736
60 60466176
61 1679616
62 362797056
63 47751966659678405306351616
64 78364164096
65 46656
66 46656
67 1679616
68 101559956668416
69 10077696
70 362797056
71 131621703842267136
72 170581728179578208256
73 16926659444736
74 2821109907456
75 47751966659678405306351616
76 7776
77 7776
78 2176782336
79 279936
80 28430288029929701376
81 789730223053602816
82 2176782336
83 78364164096
84 470184984576
85 21936950640377856
86 36845653286788892983296
87 61886548790943213277031694336
88 28430288029929701376
89 789730223053602816
90 2821109907456
91 221073919720733357899776
92 16926659444736
93 279936
94 13060694016
95 101559956668416
96 1296
97 362797056
98 470184984576
99 279936
Real: 00:00:00.066
</pre>
=={{header|Factor}}==
{{works with|Factor|0.99 2021-02-05}}
2,172

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.