pan po ito e solve?
(2^345)/29. find the remainder?
2^345 sa binary is just 1 followed by 345 zeroes. Brute force long division kaya naman.
Wala lang but the answer is 21.
(2^345)/29 = 17186261501689712417186261501689712417186261501689712417186261501689712417186261501689712417186261501689712417 remainder 21.
Actually a short C language program did it in a flash.
#include <stdio.h>
#define DIVISOR 29
typedef unsigned char INT8;
void main ()
{
INT8 INT345[44];
INT8 OUT345[44];
int i, input;
input = 0;
// initialize 2^345
for (i=0; i<44; i++)
{
INT345[i] = 0;
OUT345[i] = 0;
}
INT345[43] = 2; // 1 followed by 345 zeroes
for (i=43; i>=0; i--)
{
input = (input<<8) + INT345[i];
OUT345[i] = input/DIVISOR;
input = input%DIVISOR; //Save the remainder for carry.
}
printf("\n");
for (i=43; i>=0; i--)
{
printf("%i", OUT345[i]);
}
printf("\n Remainder is %i", input);
}