Narcissistic decimal number: Difference between revisions

Line 576:
=={{header|F Sharp|F#}}==
<lang fsharp>
//Naïve solution of Narcissitic number: Nigel Galloway - Febryary 18th., 2015
open System
let rec _Digits (n,g) = if n < 10 then n::g else _Digits(n/10,n%10::g)
 
seq{0 .. Int32.MaxValue} |> Seq.filter (fun n ->
let d = _Digits (n, [])
d |> List.fold (fun a l -> a + int ((float l) ** (float (List.length d)))) 0 = n) |> Seq.take(25) |> Seq.iter (printfn "%A")
</lang>
{{out}}
<pre>
0
1
2
3
4
5
6
7
8
9
153
370
371
407
1634
8208
9474
54748
92727
93084
548834
1741725
4210818
9800817
9926315
</pre>
=={{header|FunL}}==
<lang funl>def narcissistic( start ) =
2,172

edits