# Tutorial

Here is an example of using the parallel sequence combinators:

 ``` 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: ``` ```#r "FSharp.Collections.ParallelSeq.dll" open FSharp.Collections.ParallelSeq let isPrime n = let upperBound = int (sqrt (float n)) let hasDivisor = [2..upperBound] |> List.exists (fun i -> n % i = 0) not hasDivisor let nums = [|1..500000|] let finalDigitOfPrimes = nums |> PSeq.filter isPrime |> PSeq.groupBy (fun i -> i % 10) |> PSeq.map (fun (k, vs) -> (k, Seq.length vs)) |> PSeq.toArray let averageOfFinalDigit = nums |> PSeq.filter isPrime |> PSeq.groupBy (fun i -> i % 10) |> PSeq.map (fun (k, vs) -> (k, Seq.length vs)) |> PSeq.averageBy (fun (k,n) -> float n) let sumOfLastDigitsOfPrimes = nums |> PSeq.filter isPrime |> PSeq.sumBy (fun x -> x % 10)```
namespace FSharp
namespace FSharp.Collections
namespace FSharp.Collections.ParallelSeq
val isPrime : n:int -> bool

Full name: Tutorial.isPrime
val n : int
val upperBound : 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<_>
val sqrt : value:'T -> 'U (requires member Sqrt)

Full name: Microsoft.FSharp.Core.Operators.sqrt
Multiple items
val float : value:'T -> float (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.float

--------------------
type float = System.Double

Full name: Microsoft.FSharp.Core.float

--------------------
type float<'Measure> = float

Full name: Microsoft.FSharp.Core.float<_>
val hasDivisor : bool
Multiple items
module List

from Microsoft.FSharp.Collections

--------------------
type List<'T> =
| ( [] )
| ( :: ) of Head: 'T * Tail: 'T list
interface IEnumerable
interface IEnumerable<'T>
member Head : 'T
member IsEmpty : bool
member Item : index:int -> 'T with get
member Length : int
member Tail : 'T list
static member Cons : head:'T * tail:'T list -> 'T list
static member Empty : 'T list

Full name: Microsoft.FSharp.Collections.List<_>
val exists : predicate:('T -> bool) -> list:'T list -> bool

Full name: Microsoft.FSharp.Collections.List.exists
val i : int
val not : value:bool -> bool

Full name: Microsoft.FSharp.Core.Operators.not
val nums : int []

Full name: Tutorial.nums
val finalDigitOfPrimes : (int * int) array

Full name: Tutorial.finalDigitOfPrimes
module PSeq

from FSharp.Collections.ParallelSeq
val filter : predicate:('T -> bool) -> source:seq<'T> -> pseq<'T>

Full name: FSharp.Collections.ParallelSeq.PSeq.filter
val groupBy : projection:('T -> 'Key) -> source:seq<'T> -> pseq<'Key * seq<'T>> (requires equality)

Full name: FSharp.Collections.ParallelSeq.PSeq.groupBy
val map : mapping:('T -> 'U) -> source:seq<'T> -> pseq<'U>

Full name: FSharp.Collections.ParallelSeq.PSeq.map
val k : int
val vs : seq<int>
module Seq

from Microsoft.FSharp.Collections
val length : source:seq<'T> -> int

Full name: Microsoft.FSharp.Collections.Seq.length
val toArray : source:seq<'T> -> 'T array

Full name: FSharp.Collections.ParallelSeq.PSeq.toArray
val averageOfFinalDigit : float

Full name: Tutorial.averageOfFinalDigit
val averageBy : projection:('T -> 'U) -> source:seq<'T> -> 'U (requires member ( + ) and member DivideByInt and member get_Zero)

Full name: FSharp.Collections.ParallelSeq.PSeq.averageBy
val sumOfLastDigitsOfPrimes : int

Full name: Tutorial.sumOfLastDigitsOfPrimes
val sumBy : projection:('T -> 'U) -> source:seq<'T> -> 'U (requires member ( + ) and member get_Zero)

Full name: FSharp.Collections.ParallelSeq.PSeq.sumBy
val x : int