login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A293330 Minimum number of points of the square lattice falling strictly inside a square of side n that is not perfectly aligned with the square lattice. 5

%I #38 Jul 26 2022 22:03:29

%S 0,0,2,7,12,21,32,40,57,72,96

%N Minimum number of points of the square lattice falling strictly inside a square of side n that is not perfectly aligned with the square lattice.

%C This kind of sequence is related to the practical problem of detecting regular polygons of a given size in pixellated images. This is why it explicitly excludes the minimum number of points that can be obtained with the singular case of squares that are perfectly aligned with the square lattice. Similarly for A291259 and A292060, the different regions for the centers of squares of side n (with a constant minimum number of lattice points inside them) seem to become very complex and irregular as n increases (see density plots in Links).

%C I tried several alternative algorithms to compute this sequence but they all involved some numerical procedure without exact results. These terms are estimates obtained with the proposed algorithm which for every square size: (i) makes a discrete exploration of the continuous tridimensional space that determines the container square (two coordinates for the center and one for the orientation), (ii) checks the number of points falling inside, and (iii) picks the lowest obtained number.

%C In short, these numbers have not been rigorously proved to be correct. - _N. J. A. Sloane_, Mar 31 2018

%H Andres Cicuttin, <a href="/A293330/a293330.pdf">Plots of different regions for the centers of squares of side n with constant minimum numbers of lattice points inside them</a>

%H Hugo Pfoertner, <a href="/A293330/a293330_2.pdf">Illustrations of upper bounds for the terms a(1)..a(25)</a>

%F a(n) ~ n^2.

%t (* This gives a polar function of a k-sides regular polygon with side length "side" *)

%t PolarPolygonSide[sidelength_, theta_,

%t k_] := ((sidelength/2)/Tan[Pi/k])/

%t Cos[Mod[theta - Pi/k, 2 Pi/k] - Pi/k];

%t (* {x,y}: coordinate of the test point,

%t phase: angle offset,

%t sides: number of sides *)

%t TruePointInsidePhase[x_, y_, sidelength_, phase_, sides_] :=

%t Module[{theta}, theta = ArcTan[x, y] + phase;

%t If[x^2 + y^2 == 0, 1,

%t If[x^2 + y^2 - (PolarPolygonSide[sidelength, theta, sides]^2) < 0, 1, 0]] // Return];

%t sides = 4; dstep = 0.025; phasestep = 2 Pi/300;

%t epsilon = 2Pi*10^-6; (* small initial angle to avoid a perfectly aligned square *)

%t seq = {};

%t Do[npoints = {}; k = 0;

%t Do[Do[Do[

%t Do[Do[k =

%t k + TruePointInsidePhase[i + di, j + dj, sidelength, phase, sides],

%t {i, -sidelength - 1, sidelength + 1, 1}],

%t {j, -sidelength - 1, sidelength + 1, 1}];

%t AppendTo[npoints, k]; k = 0;,

%t {dj, 0, 1/2, dstep}],

%t {di, 0, 1/2, dstep}],

%t {phase, epsilon, 2 Pi/sides, phasestep}] // Quiet;

%t temp = npoints // Min;

%t AppendTo[seq, temp]; Print[seq // Last], {sidelength, 0, 10, 1}]

%t Print[seq]

%t (*

%t (*This gives the number of points strictly inside a polygone given by

%t function "PolarPolygonSide" of "sides" sides, side length: "sidelength", centered in (-di,-dj) and rotated by "phasestep" radians wrt to initial orientation: *)

%t FaeDensityPlot[sides_, sidelength_, di_, dj_, phasestep_] :=

%t Module[{npoints = {}, kamin = {}, k = 0},

%t Quiet[Do[Do[

%t Do[k = k +

%t TruePointInsidePhase[i + di, j + dj, sidelength, phase,

%t sides], {i, -sidelength - 1, sidelength + 1,

%t 1}], {j, -sidelength - 1, sidelength + 1, 1}];

%t AppendTo[npoints, k];

%t k = 0;, {phase, 0, (2 \[Pi])/sides, phasestep}]];

%t Return[Min[npoints]]]

%t (*This plots the regions for the centers of squares of side "sidelength" with constant minimum numbers of lattice points inside*)

%t sidelength=6;

%t DensityPlot[FaeDensityPlot[4, sidelength, x, y, (2 \[Pi])/300] ,{x, 0, 1/2}, {y, 0, 1/2}, PlotPoints -> 100, PlotRange -> All, ColorFunction -> "DeepSeaColors", MaxRecursion -> 3, PerformanceGoal -> "Quality", PlotTheme -> "Detailed", PlotLegends -> Automatic]

%t *)

%Y Cf. A291259, A292060.

%K nonn,hard,more

%O 0,3

%A _Andres Cicuttin_, Oct 06 2017

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 04:42 EDT 2024. Contains 371964 sequences. (Running on oeis4.)