0 people like it.
Like the snippet!
Project Euler #4
1:
2:
3:
4:
5:
6:
7:
8:
9:
|
let is_palindrome n = n = int(new string(n.ToString().ToCharArray() |> Array.rev))
let is_divisible_by_3_dig_num x = [100..999] |> Seq.exists(fun a -> x%a = 0)
let rec find_num x = if (is_palindrome x && is_divisible_by_3_dig_num x) then Some(x)
elif x > (100*100) then find_num(x-1)
else None
(999*999) |> find_num |> printfn "%A"
|
val is_palindrome : n:int -> bool
Full name: Script.is_palindrome
val n : int
Multiple items
val int : value:'T -> int (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.int
--------------------
type int = int32
Full name: Microsoft.FSharp.Core.int
--------------------
type int<'Measure> = int
Full name: Microsoft.FSharp.Core.int<_>
Multiple items
val string : value:'T -> string
Full name: Microsoft.FSharp.Core.Operators.string
--------------------
type string = System.String
Full name: Microsoft.FSharp.Core.string
System.Int32.ToString() : string
System.Int32.ToString(provider: System.IFormatProvider) : string
System.Int32.ToString(format: string) : string
System.Int32.ToString(format: string, provider: System.IFormatProvider) : string
module Array
from Microsoft.FSharp.Collections
val rev : array:'T [] -> 'T []
Full name: Microsoft.FSharp.Collections.Array.rev
val is_divisible_by_3_dig_num : x:int -> bool
Full name: Script.is_divisible_by_3_dig_num
val x : int
module Seq
from Microsoft.FSharp.Collections
val exists : predicate:('T -> bool) -> source:seq<'T> -> bool
Full name: Microsoft.FSharp.Collections.Seq.exists
val a : int
val find_num : x:int -> int option
Full name: Script.find_num
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>
val printfn : format:Printf.TextWriterFormat<'T> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
More information