cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A257745 Prime numbers that have a hexagonal Voronoi cell in the Voronoi diagram of the Ulam prime spiral.

Original entry on oeis.org

5, 7, 41, 43, 89, 127, 179, 193, 233, 263, 283, 317, 379, 383, 397, 443, 457, 487, 503, 547, 599, 607, 631, 643, 647, 719, 733, 787, 809, 821, 839, 937, 947, 971, 977, 997, 1019, 1039, 1049, 1069, 1091, 1097, 1103, 1109, 1187, 1193, 1217, 1231
Offset: 1

Views

Author

Vardan Semerjyan, May 07 2015

Keywords

Crossrefs

Programs

  • MATLAB
    sz  = 201; % Size of the N x N square matrix
    mat = spiral(sz); % MATLAB Function
    k = 1;
    for i =1:sz
        for j=1:sz
            if isprime(mat(i,j)) % Check if the number is prime
                % saving indices of primes
                y(k) = i; x(k) = j;
                k = k+1;
            end
        end
    end
    xy = [x',y'];
    [v,c] = voronoin(xy); %  Returns Voronoi vertices V and
    % the Voronoi cells C
    k = 1;
    for i = 1:length(c)
      szv = size(v(c{i},1));
      polyN(i) = szv(1);
      if polyN(i) == 6
            A(k) = mat(y(i),x(i));
            k = k+1;
          end
    end
    % Print terms
    A = sort(A);
    fprintf('A = ');
    fprintf('%i, ',A);
    % When running the code be aware that the last terms you get might not be correct.
    % They correspond to the points on the outer edges of the spiral which might be
    % altered when considering a larger spiral.
    % Use larger spiral to get more terms