Cody

# Problem 1411. Number of lattice points within a circle

Solution 230030

Submitted on 12 Apr 2013 by James
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% assert(isequal(within_circle(1),5))

``` ans = 5 ```

2   Pass
%% assert(isequal(within_circle(3),9))

``` ans = 9 ```

3   Pass
%% assert(isequal(within_circle(20),69))

``` ans = 69 ```

4   Pass
%% assert(isequal(within_circle(45),145))

``` ans = 145 ```

5   Pass
%% assert(isequal(within_circle(55),177))

``` ans = 177 ```

6   Pass
%% assert(isequal(within_circle(500),1581))

``` ans = 1581 ```

7   Pass
%% assert(isequal(within_circle(10000),31417))

``` ans = 31417 ```

8   Pass
%% assert(isequal(within_circle(50000),157093))

``` ans = 157093 ```

9   Pass
%% assert(isequal(within_circle(999999),3141521))

``` ans = 3141521 ```

10   Pass
%% assert(isequal(within_circle(9999999),31415993))

``` ans = 31415993 ```

11   Pass
%% assert(isequal(within_circle(99999999),314159017)) % Approaching to Pi...

``` ans = 314159017 ```

12   Pass
%% filetext = fileread('within_circle.m'); assert(isempty(strfind(filetext, 'switch'))) assert(isempty(strfind(filetext, 'case'))) assert(isempty(strfind(filetext, 'if')))

``` ```