Small Satellites

Home » Math » Ulam spiral,Prime factors spiral

Ulam spiral,Prime factors spiral

 

Ulam spiral,prime spiral

clc; clear all; close all;
sz  = 201;
mat = spiral(sz);
pm  = ~isprime(mat);
figure('Position',[0 0 800 800]);
imagesc(pm);
colormap bone;
caxis([0, 1]);axis off;

PrimeSquare

Prime factor colormap

Black dots are prime numbers. As lighter is the dot as higher is the number of prime factors of that number in the Ulam spiral.

sz  = 201;
mat  = spiral(sz);
matf = zeros(sz);
for i = 1:sz
    for j = 1:sz
         fac = factor(mat(i,j));
         fm = size(fac);
         matf(i,j) = fm(2);
    end
end
figure('Position',[0 0 800 800]);
imagesc(matf);
colormap hot;
caxis([1, max(matf(:))]);axis off;

Prime Factor Color-map

Ulam spiral of prime number of prime factors

Black dots corespondend to the numbers in Ulam spiral which has a prime number of prime factors.

sz  = 201;
mat  = spiral(sz);
matf = zeros(sz);
for i = 1:sz
    for j = 1:sz
         fac = factor(mat(i,j));
         fm = size(fac);
         matf(i,j) = fm(2);
    end
end
figure('Position',[0 0 800 800]);
pm  = ~isprime(matf);
%sum(pm(:));
imagesc(pm);
colormap bone;
caxis([0, 1]);axis off;

PrimeFactror


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Recent Post

%d bloggers like this: