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.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #162: Hexadecimal numbers

Project Euler #162: Hexadecimal numbers

Problem
Submissions
Leaderboard
Discussions

This problem is a programming version of Problem 162 from projecteuler.net

In the hexadecimal number system numbers are represented using different digits:

The hexadecimal number AF when written in the decimal number system equals .

In the hexadecimal numbers and the digits and are all present.

Like numbers written in base ten we write hexadecimal numbers without leading zeroes.

How many hexadecimal numbers containing at most hexadecimal digits exist with all of the digits and present at least once?

Give your answer modulo .

Input Format

The first line contains an integer, .

Constraints

Output Format

Print the answer modulo .

Sample Input

3

Sample Output

4

Author

Arterm

Difficulty

Medium

Max Score

100

Submitted By

1113

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy