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.

A257528 Prime numbers that have a quadrilateral Voronoi cell in the Voronoi diagram of the Ulam prime spiral.

Original entry on oeis.org

23, 31, 47, 59, 71, 73, 79, 131, 139, 167, 173, 181, 229, 239, 251, 269, 277, 331, 353, 359, 367, 421, 439, 449, 467, 479, 499, 587, 617, 661, 701, 709, 739, 751, 761, 797, 887, 941, 967, 1021, 1063, 1129, 1151, 1171, 1181, 1229, 1279, 1291, 1303, 1321, 1427, 1429, 1451, 1481
Offset: 1

Views

Author

Vardan Semerjyan, Apr 28 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) == 4
            A(k) = mat(y(i),x(i));
            k = k+1;
          end
    end
    % Print terms
    A = sort(A);
    fprintf('A = ');
    fprintf('%i, ',A);
    % Note that the last terms 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 a larger spiral to get more terms.