All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
The Count of Integers (Posted on 2023-06-12) Difficulty: 3 of 5
Given a circle x^2+y^2=r^2

Evaluate the number of points with integer coordinates ( both x and y ) inside the circle ( i.e. points within the area enclosed by the curve)

See The Solution Submitted by Ady TZIDON    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
re: for integral r only (spoiler) | Comment 2 of 3 |
(In reply to for integral r only (spoiler) by Charlie)

Actually, the algorithm, and the formula from OEIS, seem to work well even for non-integers, and that seems intuitive as the formula accounts for the integral nature of the grid by using the floor function.

Running this though give me an example of the importance of noting the possibility of rounding errors not taking consideration of points exactly on the circumference of the circle. Initially I was counting by .01 for the below, but integral r was not showing the points at the end of each radius as being exactly on the circle. I changed to use a variable that incremented by 1 each time but went to 1000, and divided by 100. That fixed the rounding problem for thee, but there may be other points exactly on the circumference that this does not fix.



      r        interior  circumference total    OEIS formula
    0.30          1         0          1          1
    0.31          1         0          1          1
    0.32          1         0          1          1
    0.33          1         0          1          1
    0.34          1         0          1          1
    0.35          1         0          1          1
    0.36          1         0          1          1
    0.37          1         0          1          1
    0.38          1         0          1          1
    0.39          1         0          1          1
    0.40          1         0          1          1
    0.41          1         0          1          1
    0.42          1         0          1          1
    0.43          1         0          1          1
    0.44          1         0          1          1
    0.45          1         0          1          1
    0.46          1         0          1          1
    0.47          1         0          1          1
    0.48          1         0          1          1
    0.49          1         0          1          1
    0.50          1         0          1          1
    0.51          1         0          1          1
    0.52          1         0          1          1
    0.53          1         0          1          1
    0.54          1         0          1          1
    0.55          1         0          1          1
    0.56          1         0          1          1
    0.57          1         0          1          1
    0.58          1         0          1          1
    0.59          1         0          1          1
    0.60          1         0          1          1
    0.61          1         0          1          1
    0.62          1         0          1          1
    0.63          1         0          1          1
    0.64          1         0          1          1
    0.65          1         0          1          1
    0.66          1         0          1          1
    0.67          1         0          1          1
    0.68          1         0          1          1
    0.69          1         0          1          1
    0.70          1         0          1          1
    0.71          1         0          1          1
    0.72          1         0          1          1
    0.73          1         0          1          1
    0.74          1         0          1          1
    0.75          1         0          1          1
    0.76          1         0          1          1
    0.77          1         0          1          1
    0.78          1         0          1          1
    0.79          1         0          1          1
    0.80          1         0          1          1
    0.81          1         0          1          1
    0.82          1         0          1          1
    0.83          1         0          1          1
    0.84          1         0          1          1
    0.85          1         0          1          1
    0.86          1         0          1          1
    0.87          1         0          1          1
    0.88          1         0          1          1
    0.89          1         0          1          1
    0.90          1         0          1          1
    0.91          1         0          1          1
    0.92          1         0          1          1
    0.93          1         0          1          1
    0.94          1         0          1          1
    0.95          1         0          1          1
    0.96          1         0          1          1
    0.97          1         0          1          1
    0.98          1         0          1          1
    0.99          1         0          1          1
    1.00          1         4          5          5
    1.01          5         0          5          5
    1.02          5         0          5          5
    1.03          5         0          5          5
    1.04          5         0          5          5
    1.05          5         0          5          5
    1.06          5         0          5          5
    1.07          5         0          5          5
    1.08          5         0          5          5
    1.09          5         0          5          5
    1.10          5         0          5          5
    1.11          5         0          5          5
    1.12          5         0          5          5
    1.13          5         0          5          5
    1.14          5         0          5          5
    1.15          5         0          5          5
    1.16          5         0          5          5
    1.17          5         0          5          5
    1.18          5         0          5          5
    1.19          5         0          5          5
    1.20          5         0          5          5
    1.21          5         0          5          5
    1.22          5         0          5          5
    1.23          5         0          5          5
    1.24          5         0          5          5
    1.25          5         0          5          5
    1.26          5         0          5          5
    1.27          5         0          5          5
    1.28          5         0          5          5
    1.29          5         0          5          5
    1.30          5         0          5          5
    1.31          5         0          5          5
    1.32          5         0          5          5
    1.33          5         0          5          5
    1.34          5         0          5          5
    1.35          5         0          5          5
    1.36          5         0          5          5
    1.37          5         0          5          5
    1.38          5         0          5          5
    1.39          5         0          5          5
    1.40          5         0          5          5
    1.41          5         0          5          5
    1.42          9         0          9          9
    1.43          9         0          9          9
    1.44          9         0          9          9
    1.45          9         0          9          9
    1.46          9         0          9          9
    1.47          9         0          9          9
    1.48          9         0          9          9
    1.49          9         0          9          9
    1.50          9         0          9          9
    1.51          9         0          9          9
    1.52          9         0          9          9
    1.53          9         0          9          9
    1.54          9         0          9          9
    1.55          9         0          9          9
    1.56          9         0          9          9
    1.57          9         0          9          9
    1.58          9         0          9          9
    1.59          9         0          9          9
    1.60          9         0          9          9
    1.61          9         0          9          9
    1.62          9         0          9          9
    1.63          9         0          9          9
    1.64          9         0          9          9
    1.65          9         0          9          9
    1.66          9         0          9          9
    1.67          9         0          9          9
    1.68          9         0          9          9
    1.69          9         0          9          9
    1.70          9         0          9          9
    1.71          9         0          9          9
    1.72          9         0          9          9
    1.73          9         0          9          9
    1.74          9         0          9          9
    1.75          9         0          9          9
    1.76          9         0          9          9
    1.77          9         0          9          9
    1.78          9         0          9          9
    1.79          9         0          9          9
    1.80          9         0          9          9
    1.81          9         0          9          9
    1.82          9         0          9          9
    1.83          9         0          9          9
    1.84          9         0          9          9
    1.85          9         0          9          9
    1.86          9         0          9          9
    1.87          9         0          9          9
    1.88          9         0          9          9
    1.89          9         0          9          9
    1.90          9         0          9          9
    1.91          9         0          9          9
    1.92          9         0          9          9
    1.93          9         0          9          9
    1.94          9         0          9          9
    1.95          9         0          9          9
    1.96          9         0          9          9
    1.97          9         0          9          9
    1.98          9         0          9          9
    1.99          9         0          9          9
    2.00          9         4         13         13
    2.01         13         0         13         13
    2.02         13         0         13         13
    2.03         13         0         13         13
    2.04         13         0         13         13
    2.05         13         0         13         13
    2.06         13         0         13         13
    2.07         13         0         13         13
    2.08         13         0         13         13
    2.09         13         0         13         13
    2.10         13         0         13         13
    2.11         13         0         13         13
    2.12         13         0         13         13
    2.13         13         0         13         13
    2.14         13         0         13         13
    2.15         13         0         13         13
    2.16         13         0         13         13
    2.17         13         0         13         13
    2.18         13         0         13         13
    2.19         13         0         13         13
    2.20         13         0         13         13
    2.21         13         0         13         13
    2.22         13         0         13         13
    2.23         13         0         13         13
    2.24         21         0         21         21
    2.25         21         0         21         21
    2.26         21         0         21         21
    2.27         21         0         21         21
    2.28         21         0         21         21
    2.29         21         0         21         21
    2.30         21         0         21         21
    2.31         21         0         21         21
    2.32         21         0         21         21
    2.33         21         0         21         21
    2.34         21         0         21         21
    2.35         21         0         21         21
    2.36         21         0         21         21
    2.37         21         0         21         21
    2.38         21         0         21         21
    2.39         21         0         21         21
    2.40         21         0         21         21
    2.41         21         0         21         21
    2.42         21         0         21         21
    2.43         21         0         21         21
    2.44         21         0         21         21
    2.45         21         0         21         21
    2.46         21         0         21         21
    2.47         21         0         21         21
    2.48         21         0         21         21
    2.49         21         0         21         21
    2.50         21         0         21         21
    2.51         21         0         21         21
    2.52         21         0         21         21
    2.53         21         0         21         21
    2.54         21         0         21         21
    2.55         21         0         21         21
    2.56         21         0         21         21
    2.57         21         0         21         21
    2.58         21         0         21         21
    2.59         21         0         21         21
    2.60         21         0         21         21
    2.61         21         0         21         21
    2.62         21         0         21         21
    2.63         21         0         21         21
    2.64         21         0         21         21
    2.65         21         0         21         21
    2.66         21         0         21         21
    2.67         21         0         21         21
    2.68         21         0         21         21
    2.69         21         0         21         21
    2.70         21         0         21         21
    2.71         21         0         21         21
    2.72         21         0         21         21
    2.73         21         0         21         21
    2.74         21         0         21         21
    2.75         21         0         21         21
    2.76         21         0         21         21
    2.77         21         0         21         21
    2.78         21         0         21         21
    2.79         21         0         21         21
    2.80         21         0         21         21
    2.81         21         0         21         21
    2.82         21         0         21         21
    2.83         25         0         25         25
    2.84         25         0         25         25
    2.85         25         0         25         25
    2.86         25         0         25         25
    2.87         25         0         25         25
    2.88         25         0         25         25
    2.89         25         0         25         25
    2.90         25         0         25         25
    2.91         25         0         25         25
    2.92         25         0         25         25
    2.93         25         0         25         25
    2.94         25         0         25         25
    2.95         25         0         25         25
    2.96         25         0         25         25
    2.97         25         0         25         25
    2.98         25         0         25         25
    2.99         25         0         25         25
    3.00         25         4         29         29
    3.01         29         0         29         29
    3.02         29         0         29         29
    3.03         29         0         29         29
    3.04         29         0         29         29
    3.05         29         0         29         29
    3.06         29         0         29         29
    3.07         29         0         29         29
    3.08         29         0         29         29
    3.09         29         0         29         29
    3.10         29         0         29         29
    3.11         29         0         29         29
    3.12         29         0         29         29
    3.13         29         0         29         29
    3.14         29         0         29         29
    3.15         29         0         29         29
    3.16         29         0         29         29
    3.17         37         0         37         37
    3.18         37         0         37         37
    3.19         37         0         37         37
    3.20         37         0         37         37
    3.21         37         0         37         37
    3.22         37         0         37         37
    3.23         37         0         37         37
    3.24         37         0         37         37
    3.25         37         0         37         37
    3.26         37         0         37         37
    3.27         37         0         37         37
    3.28         37         0         37         37
    3.29         37         0         37         37
    3.30         37         0         37         37
    3.31         37         0         37         37
    3.32         37         0         37         37
    3.33         37         0         37         37
    3.34         37         0         37         37
    3.35         37         0         37         37
    3.36         37         0         37         37
    3.37         37         0         37         37
    3.38         37         0         37         37
    3.39         37         0         37         37
    3.40         37         0         37         37
    3.41         37         0         37         37
    3.42         37         0         37         37
    3.43         37         0         37         37
    3.44         37         0         37         37
    3.45         37         0         37         37
    3.46         37         0         37         37
    3.47         37         0         37         37
    3.48         37         0         37         37
    3.49         37         0         37         37
    3.50         37         0         37         37
    3.51         37         0         37         37
    3.52         37         0         37         37
    3.53         37         0         37         37
    3.54         37         0         37         37
    3.55         37         0         37         37
    3.56         37         0         37         37
    3.57         37         0         37         37
    3.58         37         0         37         37
    3.59         37         0         37         37
    3.60         37         0         37         37
    3.61         45         0         45         45
    3.62         45         0         45         45
    3.63         45         0         45         45
    3.64         45         0         45         45
    3.65         45         0         45         45
    3.66         45         0         45         45
    3.67         45         0         45         45
    3.68         45         0         45         45
    3.69         45         0         45         45
    3.70         45         0         45         45
    3.71         45         0         45         45
    3.72         45         0         45         45
    3.73         45         0         45         45
    3.74         45         0         45         45
    3.75         45         0         45         45
    3.76         45         0         45         45
    3.77         45         0         45         45
    3.78         45         0         45         45
    3.79         45         0         45         45
    3.80         45         0         45         45
    3.81         45         0         45         45
    3.82         45         0         45         45
    3.83         45         0         45         45
    3.84         45         0         45         45
    3.85         45         0         45         45
    3.86         45         0         45         45
    3.87         45         0         45         45
    3.88         45         0         45         45
    3.89         45         0         45         45
    3.90         45         0         45         45
    3.91         45         0         45         45
    3.92         45         0         45         45
    3.93         45         0         45         45
    3.94         45         0         45         45
    3.95         45         0         45         45
    3.96         45         0         45         45
    3.97         45         0         45         45
    3.98         45         0         45         45
    3.99         45         0         45         45
    4.00         45         4         49         49
    4.01         49         0         49         49
    4.02         49         0         49         49
    4.03         49         0         49         49
    4.04         49         0         49         49
    4.05         49         0         49         49
    4.06         49         0         49         49
    4.07         49         0         49         49
    4.08         49         0         49         49
    4.09         49         0         49         49
    4.10         49         0         49         49
    4.11         49         0         49         49
    4.12         49         0         49         49
    4.13         57         0         57         57
    4.14         57         0         57         57
    4.15         57         0         57         57
    4.16         57         0         57         57
    4.17         57         0         57         57
    4.18         57         0         57         57
    4.19         57         0         57         57
    4.20         57         0         57         57
    4.21         57         0      &n
  Posted by Charlie on 2023-06-12 13:35:10
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information