Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 14 lines (10 sloc) 0.335 kb
a0f2aeb Another two problems solved for level 1
Andrey Paramonov authored
1 %% Problem
2 %% ---------------------
3 %% What is the sum of the numbers on the diagonals in a 1001 by 1001
4 %% spiral formed in the same way?
5 %% ---------------------
6
7 -module(p028).
8 -export([solve/0]).
9
10
11 %% N^2 + (N^2-N+1) + (N^2-2N+2) + (N^2-3N+3) = 4N^2-6N+6
12 %%
13 solve() -> 1 + lists:sum([ 4*N*N-6*N+6 || N <- lists:seq(3, 1001, 2) ]).
Something went wrong with that request. Please try again.