mathematical script - count distinct numbers in arrays subject to certain conditions -- 6

Job ID: 37931465

Budget: $10 – $30 USD

i need someone who is good at writing mathematical scripts
this job i need to develop a script to count distinct numbers in the outputted arrays
we can specify conditions like min or max etc
example
--------------
suppose i want to count all distinct numbers in the following sets of numbers
i will set a the MIN as 1 and MAX as 100 (but i can change this using boxes to enter min and max)
to generate the sets or arrays the program asks us for a starting number, increment and max number
note: max number is NOT mandatory
when i am counting the distinct numbers i can either
1. count all the distinct numbers between a MIN and a MAX that i specify or if i dont specify then we count between the starting number and the max number.
we can declare more than one set and in this case it will combine all the outputted numbers of all the sets then count the distinct numbers, so technially we are counting the DISTINCT numbers of the UNION of all the sets. If there is only 1 set then the UNION is just the set. (set 1)

note: i will enter the starting number, increment and ending number in the boxes for each set

set 1: starting number 3, increment 3, ending number 30
output of set 1: [3,6,9,12,15,18,21,24,27,30]

set 2: starting number 5, increment 5 ending number 30
output of set 2: {5,10,15,20,25,30}

then to get the COUNT we need to

COUNT DISTINCT UNION ALL SETS
in this
COUNT DISTINCT (SET 1 U SET 2)

SET 1 U SET 2 = {3,6,9,12,15,18,21,24,27,30} U {5,10,15,20,25,30}
= {3,5,6,9,10,12,15,18,20,21,24,25,27,30}

SO COUNT DISTINCT = 14

please note we can do this directly using UNION and removing any repeats or we can notice that
count distinct for set 1 = 10
count distinct for set 2 = 6
count for set 1 + set 2 = 16
intersection of set 1,2 = SET 1 intersect SET 2 = {15,30}
count SET 1 intersect SET 2 = 2

Therefore COUNT DISTINCT also equals COUNT (SET 1 + SET 2) - ( Count( SET 1 intersect SET 2))
= 10 + 6 - 2
=14

BUT THE UNION METHOD SEEMS FASTER IN MY VIEW

Essentially when we COUNT DISTINCT of all sets combined we are technically counting the elements in the UNION of all the sets...
Here is another special example
set 1: 1 2 3 4 5 6
set 2 : 1 2 3 4 5
set 3: 3 4 5 6


COUNT DISTINCT = 6
since the union is {1 2 3 4 5 6}

Note: the sets do NOT need to contain the same amount of elements

if howwever i specify the MIN as 3 and the MAX as 5 then COUNT DISTINCT will be 3 as 3,4,5 are distinct members of the UNION of set 1 set 2 and set 3 subject to the min and conditions

Note: dont confuse MIN and MAX with starting number and ending number

starting number , ending number are used to generate the elements of each set subject to the increment
MIN, MAX is used to COUNT between a MIN and MAX after the UNION has been determined

Note: i can add as many sets as i like so the program must allow for this

NO TIME WASTERS