Skip to content

Problem 9 [Language] #17

@jamiephillips0000

Description

@jamiephillips0000

Hi Guys
Really had fun with Problem 9

def divider(nr : Int) ={ 2000 - (2_nr)}
def numerator(nr :Int) = {1000_1000 - (2000 * nr)}
def isPos(nr : Int) = {1000*1000 - (2000 * nr) > 0}
val res = (1 to 1000).filter(x => x< 1000 && isPos(x) && numerator(x) % divider(x)==0)

println (res(0) + " --" + res(1)  + " -- " + math.sqrt(res(0)*res(0) + res(1)*res(1)).toInt)

res(0) * res(1) * math.sqrt(res(0)*res(0) + res(1)*res(1)).toInt

One suggestion though - It would be nice to know the format in which the answer should be given e.g. i had to infer from the answer of @LucDupAtGitHub that the product of all three was required. i had the correct solution but was not sure of the format of the answer. This is not a criticism just a remark ;-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions