Skip to main content
added 1 character in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
rectangles = Rectangle /@ Tuples[Range[-8, 7, 1], {2}]

Count[rectangles, _Count[_?(Not @ RegionDisjoint[Circle[{0, 0}, Sqrt[59]], #] &)] @ rectangles
60
Count[rectangles, _Count[_?(RegionWithin[Disk[{0, 0}, Sqrt[59]], #] &)] @ rectangles
156

Update: To exclude rectangles "just touching" the circle, we can use

Count[rectangles, _Count[_?(FreeQ[_EmptyRegion | _Point]@
     RegionIntersection[Circle[{0, 0}, Sqrt[59]], #] &)] @ rectangles
60
Count[rectangles, _Count[_?(FreeQ[_EmptyRegion | _Point]@
     RegionIntersection[Circle[{0, 0}, Sqrt[53]], #] &)] @ rectangles
52
rectangles = Rectangle /@ Tuples[Range[-8, 7, 1], {2}]

Count[rectangles, _?(Not @ RegionDisjoint[Circle[{0, 0}, Sqrt[59]], #] &)]
60
Count[rectangles, _?(RegionWithin[Disk[{0, 0}, Sqrt[59]], #] &)]
156

Update: To exclude rectangles "just touching" the circle, we can use

Count[rectangles, _?(FreeQ[_EmptyRegion | _Point]@
     RegionIntersection[Circle[{0, 0}, Sqrt[59]], #] &)]
60
Count[rectangles, _?(FreeQ[_EmptyRegion | _Point]@
     RegionIntersection[Circle[{0, 0}, Sqrt[53]], #] &)]
52
rectangles = Rectangle /@ Tuples[Range[-8, 7, 1], {2}]

Count[_?(Not @ RegionDisjoint[Circle[{0, 0}, Sqrt[59]], #] &)] @ rectangles
60
Count[_?(RegionWithin[Disk[{0, 0}, Sqrt[59]], #] &)] @ rectangles
156

Update: To exclude rectangles "just touching" the circle, we can use

Count[_?(FreeQ[_EmptyRegion | _Point]@
  RegionIntersection[Circle[{0, 0}, Sqrt[59]], #] &)] @ rectangles
60
Count[_?(FreeQ[_EmptyRegion | _Point]@
     RegionIntersection[Circle[{0, 0}, Sqrt[53]], #] &)] @ rectangles
52
added 336 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
rectangles = Rectangle /@ Tuples[Range[-8, 7, 1], {2}]

Count[rectangles, _?(Not @ RegionDisjoint[Circle[{0, 0}, Sqrt[59]], #] &)]
60
Count[rectangles, _?(RegionWithin[Disk[{0, 0}, Sqrt[59]], #] &)]
156

Update: To exclude rectangles "just touching" the circle, we can use

Count[rectangles, _?(FreeQ[_EmptyRegion | _Point]@
     RegionIntersection[Circle[{0, 0}, Sqrt[59]], #] &)]
60
Count[rectangles, _?(FreeQ[_EmptyRegion | _Point]@
     RegionIntersection[Circle[{0, 0}, Sqrt[53]], #] &)]
52
rectangles = Rectangle /@ Tuples[Range[-8, 7, 1], {2}]

Count[rectangles, _?(Not @ RegionDisjoint[Circle[{0, 0}, Sqrt[59]], #] &)]
60
Count[rectangles, _?(RegionWithin[Disk[{0, 0}, Sqrt[59]], #] &)]
156
rectangles = Rectangle /@ Tuples[Range[-8, 7, 1], {2}]

Count[rectangles, _?(Not @ RegionDisjoint[Circle[{0, 0}, Sqrt[59]], #] &)]
60
Count[rectangles, _?(RegionWithin[Disk[{0, 0}, Sqrt[59]], #] &)]
156

Update: To exclude rectangles "just touching" the circle, we can use

Count[rectangles, _?(FreeQ[_EmptyRegion | _Point]@
     RegionIntersection[Circle[{0, 0}, Sqrt[59]], #] &)]
60
Count[rectangles, _?(FreeQ[_EmptyRegion | _Point]@
     RegionIntersection[Circle[{0, 0}, Sqrt[53]], #] &)]
52
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

rectangles = Rectangle /@ Tuples[Range[-8, 7, 1], {2}]

Count[rectangles, _?(Not @ RegionDisjoint[Circle[{0, 0}, Sqrt[59]], #] &)]
60
Count[rectangles, _?(RegionWithin[Disk[{0, 0}, Sqrt[59]], #] &)]
156