-
Notifications
You must be signed in to change notification settings - Fork 0
/
Problem Statement
34 lines (29 loc) · 1.33 KB
/
Problem Statement
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
1 Problem definition
An interesting problem in arithmetic with deep implications to elliptic curve
theory is the problem of nding perfect squares that are sums of consecutive
squares. A classic example is the Pythagorean identity:
32 + 42 = 52 (1)
that reveals that the sum of squares of 3; 4 is itself a square. A more interesting
example is Lucas` Square Pyramid :
12 + 22 + ::: + 242 = 702 (2)
In both of these examples, sums of squares of consecutive integers form the
square of another integer.
The goal of this rst project is to use Elixir and the actor model to build a
good solution to this problem that runs well on multi-core machines.
2 Requirements
Input: The input provided (as command line to your program, e.g. my app)
will be two numbers: N and k. The overall goal of your program is to find all
k consecutive numbers starting at 1 and up to N, such that the sum of squares
is itself a perfect square (square of an integer).
Output: Print, on independent lines, the first number in the sequence for each
solution.
Example 1:
mix run proj1.exs 3 2
3
indicates that sequences of length 2 with start point between 1 and 3 contain
3,4 as a solution since 32 + 42 = 52.
Example 1:
mix run proj1.exs 40 24
1
indicates that sequences of length 24 with start point between 1 and 40 contain
1,2,...,24 as a solution since 12 + 22 + ::: + 242 = 702.