# Project Euler #100: Arranged probability

# Project Euler #100: Arranged probability

georeth2010 + 0 comments Page 176-178 of "Quadratic Diophantine Equations" by Titu Andreescu, Dorin Andrica.

(IMHO, this is a meaningless problem)

jamespate + 0 comments The case P/Q = 1/2 like the real Project Euler Problem 100 is very easy to solve once you are able to look up the sequence: 1, 3, 15, 85, 493, 2871, 16731,... It turns out to be Sloane's integer sequence https://oeis.org/A011900 which has a nice and easy recurrence of a(n) = 6*a(n-1) - a(n-2) - 2 with a(0) = 1, a(1) = 3.

satyajeet753 + 0 comments why this can't be solved using binary search

kitchent + 0 comments Does anyone knows whether Brahmagupta's composition is applicable here or not? I'm stuck with not being able to generate

`85 120`

from`3 4`

and`15 21`

.Even completing squares to arrive at Pell's equation with integer is troublesome with like

`3 8`

. No clue yet.**EDIT**: It gets frustrating. This time I follow the continued fraction approach. The trouble is still at the very beginning. While now I know that as a perfect square should result in`No solution`

, I could not get the Pell's Equation in its appropriate form. The one I've got is , where . So now it is . But when I plug in with and for the case and , those and are not integers. The fact is that, I couldn't even get the fundamental solutions for and right.Is it possible that there are multiple valid Pell's Equations for one input? But then there would be infinitely many such equations as I could just modify the corresponding . This idea sounds horrifying. And when

`sqrt`

is involved, answers like`181489708628619 296371453137673`

is found for`3 8 1000`

, which is obviously wrong.Also, there is the issue with

`OverflowError: long int too large to convert to float`

for Test Case #11, #16 and #17, when I tried to perform`y * sqrt(k) + 1`

.Trying to implement something like the Generic two integer variable equation solver is too overwhelming.

**EDIT 2**: Just found this, this, this, and this. That's a lot of reading ahead of me.

cantonios + 0 comments Hmm... is there an approach that doesn't require implementing a full quadratic diophantine solver? Mine has gotten extremely complex, and is starting to time out.

ykrmeena + 1 comment I am solved complete problem but having only problem with Scanner to take input.can you suggest me what can i do for take input via scanner or oter way.

zack_kenyonAsked to answer + 0 comments **Endorsed by ykrmeena**Scanner is what, java? All data is passed to the program via STDIN. you can check the hackerrank tutorial for java problems though if that's not enough.

Vignesh201293 + 1 comment Can anyone elaborate the question more thank you

ykrmeena + 0 comments their are problem to find how many blue disk having in total disk which have followed ratio of p/q :that you enter. d+1 is minimum no. of disk .Now you can solve......

No more comments

Sort 7 Discussions, By:

Please Login in order to post a comment