sahasumit288's blog

By sahasumit288, history, 8 years ago, In English

suppose we need to find (a^b)%m. If b is too large we can mode b with phi(m). That means (a^b)%m is equal ( a^ (b%phi(m)) )%m. This theorem works for number properly. Now I have a matrix M two dimensional. Here M^2=M*M,M^3=M*(M^2) and so on.I also mod elements of matrix by m. Suppose that M%m means all elements of matrix are mod by m. Now I need to find (M^b)%m and b is too large. if I mod b by phi(m) will it work? That means (M^b)%m and (M^ (b%phi(m)) )%m will be equal?

Sorry for my bad english and thanks in advance.

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By sahasumit288, history, 8 years ago, In English

Suppose I have an arithmetic sequence.

a+ (a+d) +a(a+2d)......

Here d is greater thanzero. I want mod this arithmetic sequence with M.

(a)%M + (a+d)%M + (a+2d)%M +(a+3d)%M................ Now I want to know, Any cycle will be created? If create when and why? How can I figureout the cycle?

Sorry for my bad english.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By sahasumit288, history, 8 years ago, In English

n is a number and n=(p1^c) * (p2^d).Here p1 and p2 are prime. Let a=p1^c and b=p2^d.

gcd(i,n)= gcd(i,a) * gcd(i,b)

How to prove this? Any explanation? Thanks in advance.

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

By sahasumit288, history, 8 years ago, In English

Assume we want to find a % n. Let n = p1 * p2. Find a % p1 and a % p2. Call a % p1 = x1 Call a % p2 = x2; For finding a % n. We can do following. Write a % n = x1 * alpha1 + x2 * alpha2;

How to find alpha1 and alpha2 and how to prove that a % n = x1 * alpha1 + x2 * alpha2 ?

Full text and comments »

  • Vote: I like it
  • +17
  • Vote: I do not like it

By sahasumit288, history, 9 years ago, In English

UVA -1177

I need to convert a double number to an integer and print it. Let ans is that double number. Now,if I write


printf("%0.lf\n",&ans);

I got accepted. But instead if write

cout<<(int)ans<<"\n";

I got wrong answer.

Can anyone explain it?

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it