Magic "Integer" Circles

hh hh at hyperhh.de
Sat Dec 1 20:24:11 EST 2018


Some of you may be interested in the following "mathy beauty".

Under all circles with integer radius 0 < r <= 10000 there
are four "magic" ones with radius 5, 25, 65 and 325.
These four have relatively many points of *integers* (x,y)
such that x^2 + y^2 = r^2.
(These points are NOT rounded values that only approximate
the circle value but integer values that are *on* the circle).

Clearly there are at least four such points: 
(-r,0),(0,r),(r,0),(0,-r) -- if the origin is (0,0).

Now the relation of radius and number of such points may be such
that we can visually accept a polygon of these points as circles.

To comfort you (script for an option button):

on mouseDown
  put 5 &cr& 25 &cr& 65 &cr& 325 into me
end mouseDown

on mouseUp
  put the label of me into R -- the radius = one of 5, 25, 65, 325
  if there is no grc "poly" then create grc "poly"
  set style of grc "poly" to "polygon"
  set opaque of grc "poly" to "true"
  set backColor of grc "poly" to "255,128,0"
  set markerDrawn of grc "poly" to "true"
  set markerPoints of grc "poly" to "0,0"
  set markerLineSize of grc "poly" to "3"
  set points of grc "poly" to integerPoints(R)
  set loc of grc "poly" to the loc of this card
end mouseUp

-- the circle origin is (0,0), so set the loc of the polygon later on!
function integerPoints rds
  switch rds
    case 5
      -- a circle with radius r=5 contains these 12 points of integers:
      put (4,-3)&cr&(3,-4)&cr&(0,-5)&cr&(-3,-4)&cr&(-4,-3)&cr&(-5,0)&cr& \
          (-4,3)&cr&(-3,4)&cr&(0,5)&cr&(3,4)&cr&(4,3)&cr&(5,0) into p
      break
    case 25
      -- a circle with radius r=25 contains these 20 points of integers:
      put (24,-7)&cr&(20,-15)&cr&(15,-20)&cr&(7,-24)&cr&(0,-25)&cr& \
          (-7,-24)&cr&(-15,-20)&cr&(-20,-15)&cr&(-24,-7)&cr&(-25,0)&cr& \
          (-24,7)&cr&(-20,15)&cr&(-15,20)&cr&(-7,24)&cr&(0,25)&cr& \
          (7,24)&cr&(15,20)&cr&(20,15)&cr&(24,7)&cr&(25,0) into p
      break
    case 65
      -- a circle with radius r=65 contains these 36 points of integers:
      put (63,-16)&cr&(60,-25)&cr&(56,-33)&cr&(52,-39)&cr&(39,-52)&cr& \
          (33,-56)&cr&(25,-60)&cr&(16,-63)&cr&(0,-65)&cr&(-16,-63)&cr& \
          (-25,-60)&cr&(-33,-56)&cr&(-39,-52)&cr&(-52,-39)&cr& \
          (-56,-33)&cr&(-60,-25)&cr&(-63,-16)&cr&(-65,0)&cr&(-63,16)&cr& \
          (-60,25)&cr&(-56,33)&cr&(-52,39)&cr&(-39,52)&cr&(-33,56)&cr& \
          (-25,60)&cr&(-16,63)&cr&(0,65)&cr&(16,63)&cr&(25,60)&cr& \
          (33,56)&cr&(39,52)&cr&(52,39)&cr&(56,33)&cr&(60,25)&cr& \
          (63,16)&cr&(65,0) into p
      break
    case 325
      -- a circle with radius r=325 contains these 60 points of integers:
      put (323,-36)&cr&(315,-80)&cr&(312,-91)&cr&(300,-125)&cr& \
          (280,-165)&cr&(260,-195)&cr&(253,-204)&cr&(204,-253)&cr& \
          (195,-260)&cr&(165,-280)&cr&(125,-300)&cr&(91,-312)&cr& \
          (80,-315)&cr&(36,-323)&cr&(0,-325)&cr&(-36,-323)&cr& \
          (-80,-315)&cr&(-91,-312)&cr&(-125,-300)&cr&(-165,-280)&cr& \
          (-195,-260)&cr&(-204,-253)&cr&(-253,-204)&cr&(-260,-195)&cr& \
          (-280,-165)&cr&(-300,-125)&cr&(-312,-91)&cr&(-315,-80)&cr& \
          (-323,-36)&cr&(-325,0)&cr&(-323,36)&cr&(-315,80)&cr& \
          (-312,91)&cr&(-300,125)&cr&(-280,165)&cr&(-260,195)&cr& \
          (-253,204)&cr&(-204,253)&cr&(-195,260)&cr&(-165,280)&cr& \
          (-125,300)&cr&(-91,312)&cr&(-80,315)&cr&(-36,323)&cr& \
          (0,325)&cr&(36,323)&cr&(80,315)&cr&(91,312)&cr&(125,300)&cr& \
          (165,280)&cr&(195,260)&cr&(204,253)&cr&(253,204)&cr& \
          (260,195)&cr&(280,165)&cr&(300,125)&cr&(312,91)&cr& \
          (315,80)&cr&(323,36)&cr&(325,0) into p
      break
  end switch
  return p &cr& line 1 of p -- close polygon
end integerPoints

Below are the possible number of integer points for all integers radius
values r with 0 < r <= 10000. Each of these numbers is followed by the two
smallest radii where these numbers occur.
TMHO, of these the 12:5, 20:25, 36:65 and 60:325 are acceptable to serve
alone as points of a polygon approximating a circle of radius r (see above).

[number of integer points:radius1,radius2]
4:1,2
12:5,10
20:25,50
28:125,250
36:65,85
44:3125,6250
60:325,425
84:1625,2125
100:4225,7225
108:1105,1885
180:5525,9425

For the math behind that last computation see http://oeis.org/A046109




More information about the use-livecode mailing list