Brief Proof on the Algorism using for Problem 365 of Project Euler



Lousy English, hard to read….Warning….

A=[10^18!/(10^18-10^9+1)!],
B=[10^9!];
PRIME=P;

A has a prime factor “P”s,
B has b prime factor “P”s;

since A/B is Combination(10^18,10^9),
A/B is integer;

Therefore, a>=b;

1, a>b
A/B = 0 mod P

2, a=b
A’=A/P^a;B’=B/P^b=B/p^a;
A1=A’%P; B1=B’%P;
Exists B2, B1*B2=1 mod P,since (B1,P)=1;
=>(B2,P)=1;

We can draw the conclusion below:
A/B = A1*B2 (MOD P)

Here’s the proof:
INT R = A/B = A’/B';
R = r (mod P) (1<r<P-1);
(R,P)=1;
(r,P)=1;
(A’,P)=1;
(B’,P)=1;

MOD P
RB’ = rB’
=> A’ = rB’
=> A’ = rB1
=> A’B2=r(B1*B2)=r
=> A1*B2=r=A/B

with another hint (P-1)!=1 mod P, everything is good to go.

Comments

Popular posts from this blog

Project Euler Problem 684 Inverse Digit Sum - Solution

Project Euler Problem 686 Powers of Two - Solution

Project Euler Problem 717 Summation of a Modular Formula - Solution