%% SL3: Warm-up: Calendar analysis
C = calendar()
Mo = C(:, 2);
Mo(Mo == 0) = [];
length(Mo)

weekday(1901, 1, 1) - 1

%% SL5: Relation operators
G = [pi/2 pi 3/2*pi 2*pi]
G > pi
G <= pi
G ~= pi
H = G.'; % then analogously
V = [-pi pi 1 0]
U = [1 1 1 1]
V >= U

%% SL8: Logical operators
A = pi/2:pi/2:2*pi;
A == pi | A == 2*pi
A > pi/2 & A ~= 2*pi
A = [A A(A > pi/2 & A ~= 2*pi)]

%% SL10: Logical indexing
k = 1:3:20;
m = k(k > 10 & k < 16)

M = magic(3);
all(M > 2)
any(M >= 8, 2)
all(all(M > 0))
all(M(:) > 0)
all(M > 0, 'all')

%% SL14: Prime numbers (Dirichlet's theorem)
clear; clc;
N = 1000;
a = primes(N);
b = 2:2:N; 
c = setdiff(1:N, b);
v = intersect(a, b+c)
length(v)

%% SL18: Find elements within a vector
v  = reshape(magic(4)', [1 numel(magic(4))])
v  = sort(v, 'descend');
v1 = mod(v, 3) == 0 & v > 10
v(v1)
find(v1)