forked from bobvo23/flicker_stimulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lcms.m
36 lines (28 loc) · 721 Bytes
/
lcms.m
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
30
31
32
33
34
35
36
function output = lcms(numberArray)
numberArray = reshape(numberArray, 1, []);
%% prime factorization array
for i = 1:size(numberArray,2)
temp = factor(numberArray(i));
for j = 1:size(temp,2)
output(i,j) = temp(1,j);
end
end
%% generate prime number list
p = primes(max(max(output)));
%% prepare list of occurences of each prime number
q = zeros(size(p));
%% generate the list of the maximum occurences of each prime number
for i = 1:size(p,2)
for j = 1:size(output,1)
temp = length(find(output(j,:) == p(i)));
if(temp > q(1,i))
q(1,i) = temp;
end
end
end
%% the algorithm
z = p.^q;
output = 1;
for i = 1:size(z,2)
output = output*z(1,i);
end