We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

# Project Euler #162: Hexadecimal numbers

# Project Euler #162: Hexadecimal numbers

Contest ends in

#### Sort by

recency

#### |

#### 12 Discussions

#### |

Please Login in order to post a comment

will it be :

15 * 16^(n-4) * (n-1)P3 + 2 *16^(n-3) * (n-1)P2where (n-1)P3 is like nPr.

first

15: let's say 0, 1 or A is not the most significant digit. so there will be 15 posibilities (except 0) for that digit.16^(n-4): now within remaining (n-1) digits we will have to fix 0, 1 and A somewhere. which will allow n-4 digits to be selected freely from 16 digits.(n-1)P3: we can select any 3 places out of (n-1) digits that can have 0,1 and A. here order of 0,1 and A is important so used permutation.+ other half of equation:-first

2: let's say any one of 0,1 and A is first digit (most significant). But first digit can't be 0. So we havetwochoices for first digit.16^(n-3): first digit is fix and other two digits 0 and 1/A need to be fixed. so remaining (n-3) digits can be selected from 16 digits.(n-1)P2: first digit (1 or A) is fixed and other 2 digits 0 and (1 or A) need to be placed within (n-1) places. So we can select any 2 places from (n-1) and order is important. so took permutation.Are my assumptions correct? Am I missing anything?

can somebody pls explain the problem statement

can somebody help me with modulo because i get the right answer upto n=8, when the number of ways are less than 1000000007.But after that it gives the wrong answer

I've come to this values for the first 10 N:

For instance, the combinations for N=4 that I'm assuming are:

For this test case(N=4), am I missing something ?

can someone pls tell the ans for first 10 digits do that i can check my program