COP5612 – Fall 2013
Alin Dobra August 29, 2018
• Due Date: September 10, Midnight
• One submission per group
• Submit using eLearning
• What to include:
– README file including group members, other requirements specified below
– Lastnames.zip the code for the project
1 Problem definition
An interesting problem in arithmetic with deep implications to elliptic curve theory is the problem of finding 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 first 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.
Actor modeling: In this project you have to use exclusively the actor facility in Elixir (projects that do not use multiple actors or use any other form of parallelism will receive no credit). A model similar to the one indicated in class for the problem of adding up a lot of numbers can be used here, in particular define worker actors that are given a range of problems to solve and a boss that keeps track of all the problems and perform the job assignment.
README ftle In the README file you have to include the following mate- rial:
Size of the work unit that you determined results in best performance for your implementation and an explanation on how you determined it. Size of the work unit refers to the number of sub-problems that a worker gets in a single request from the boss.
The result of running your program for
mix run proj1.exs 1000000 4
The running time for the above as reported by time for the above, i.e. run time scala project1.scala 1000000 4 and report the time. The ratio of CPU time to REAL TIME tells you how many cores were effec- tively used in the computation. If your are close to 1 you have almost no parallelism (points will be subtracted).
• The largest problem you managed to solve.
3 BONUS – 15%
Use remote actors and run you program on 2+ machines. Use your solution to solve a really large instance such as: mix run proj1.exs 100000000 20. To get the bonus points you have to give a demo to the instructor and explain your solution.
代写CS&Finance|建模|代码|系统|报告|考试
编程类:C代写,JAVA代写 ,数据库代写,WEB代写,Python代写,Matlab代写,GO语言,R代写
金融类:统计,计量,风险投资,金融工程,R语言,Python语言,Matlab,建立模型,数据分析,数据处理
服务类:Lab/Assignment/Project/Course/Qzui/Midterm/Final/Exam/Test帮助代写代考辅导
天才写手,代写CS,代写finance,代写statistics,考试助攻
E-mail:850190831@qq.com 微信:BadGeniuscs 工作时间:无休息工作日-早上8点到凌晨3点
如果您用的手机请先保存二维码到手机里面,识别图中二维码。如果用电脑,直接掏出手机果断扫描。