Here's the question you clicked on:
harshit1202
can anyone provide java /c/c++ code for following problem John is very good at mathematics and cryptography. But he has a very bad memory. He maintains positive integers as passwords.However,instead of writing them directly he encrypts them and writes the encrypted password on his desk. He has 25 as a password for some account. He observed 25 when represented in base 15 has two digits.The first is 1(most significant) and the second is 10(least significant). Hence the sum of digits of 25 when represented in base 15 is 11. (continued in comment...)
Now he is interested to find the average of sum of digits of the positive integer password P when represented in all bases from 2 to P-1. Thus he calculates an irreducible fraction, which is written in base 10. He has done all the required computations in base 10. He then writes the encrypted password on his desk. Input: First line contains one integer n, the no of test cases. From the next line starts the test cases.Each test case contains one line. the line contains an integer password P. 3<=p<=1000. Output: Output must contain encrypted password i.e. required average value in a/b form, where a is the numerator and b is the denominator. Sample test(s): Input: 2 6 3 Output: 9/4
its important any help or suggestions atleast.