Minimum multiple of m where digital sum equals m: Difference between revisions

Realize in F#
m (→‎{{header|Free Pascal}}: nested comments removed)
(Realize in F#)
Line 431:
1076923 1030303 880597 1469116 1157971 12842857</pre>
 
=={{header|F_Sharp|F#}}==
<lang fsharp>
// Minimum multiple of m where digital sum equals m. Nigel Galloway: January 31st., 2022
let SoD n=let rec SoD n=function 0L->int n |g->SoD(n+g%10L)(g/10L) in SoD 0L n
let A131382(g:int)=let rec fN i=match SoD(i*int64(g)) with
n when n=g -> i
|n when n>g -> fN (i+1L)
|n -> fN (i+(int64(ceil(float(g-n)/float n))))
fN ((((pown 10L (g/9))-1L)+int64(g%9)*(pown 10L (g/9)))/int64 g)
Seq.initInfinite((+)1>>A131382)|>Seq.take 70|>Seq.chunkBySize 10|>Seq.iter(fun n->n|>Seq.iter(printf "%13d "); printfn "")
</lang>
{{out}}
<pre>
1 1 1 1 1 1 1 1 1 19
19 4 19 19 13 28 28 11 46 199
19 109 73 37 199 73 37 271 172 1333
289 559 1303 847 1657 833 1027 1576 1282 17497
4339 2119 2323 10909 11111 12826 14617 14581 16102 199999
17449 38269 56413 37037 1108909 142498 103507 154981 150661 1333333
163918 322579 315873 937342 1076923 1030303 880597 1469116 1157971 12842857
</pre>
=={{header|FOCAL}}==
<lang focal>01.10 F N=1,40;D 2
Line 489 ⟶ 510:
N= 40 M= 17497
</pre>
 
=={{header|Forth}}==
{{works with|Gforth}}
2,172

edits