Created
August 14, 2018 11:44
-
-
Save hholst80/77614efd67ccd79ca7eea8dda738bc65 to your computer and use it in GitHub Desktop.
summa produkt pussel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
K = 100; | |
A = zeros(K); | |
B = zeros(K); | |
for x = 2:K | |
for y = 2:K | |
A(x,y) = x + y; | |
B(x,y) = x * y; | |
end | |
end | |
% Eliminate lower diagonal part of B | |
A = triu(A); | |
B = triu(B); | |
% Eliminate all unique numbers from B | |
% The way that Henrik Holst suggested doing it. | |
% for b = B(:)' | |
% if sum(B(:) == b) == 1 | |
% B(B(:) == b) = 0; | |
% end | |
% end | |
% Eliminate all factors of two primes | |
% for i = 1:K*K | |
% if length(factor(B(i))) <= 2 | |
% B(i) = 0; | |
% end | |
% end | |
% Eliminate all products divisible by a prime less than 541 | |
% NOTE: This is all products. | |
% p = primes(541); | |
% | |
% for i = 1:K*K | |
% if any(ismember(factor(B(i)), p)) | |
% B(i) = 0; | |
% end | |
% end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment