%% Primes #1 (SL07)
clear; clc;
N = 1000;
a = primes(N);
b = 2:2:N; 
c = setdiff(1:N, b);
v = intersect(a, b+c)
length(v)

%% Primes #2 (SL08)
w = setdiff(union(b, c), a)
sum(not(mod(w, 3)))

%% script depicts number of integers (SL10)
% from 1 to 1000 in 
% dependence on division remainders
clear; clc;

M = zeros(20,1);
N = 1000;
a = primes(N);
b = 2:2:N;
c = setdiff(1:N, b);
w = setdiff(union(b, c), a);

for iDiv = 1:length(M)
    M(iDiv) = sum(not(mod(w, iDiv)));
end

figure;
bar(M);

%% Radiorelay link (SL11)
sum(ismember(distances, L))
length(unique(distances))
% for comparison
length(unique(randn(1, 1e6)))

%% Import from Excel (SL22)
data = xlsread('measurement1.xlsx', 1, 'B2:D31');
plot(data(:,1), data(:,2));

%% Export to Excel (SL24)
x = -pi:0.01:pi;
fx = cos(x) + cosh(x)/10;
xlswrite('Excel_file.xlsx', x', 1, 'A1')
xlswrite('Excel_file.xlsx', fx', 1, 'B1')