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

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #155: Counting Capacitor Circuits.

Project Euler #155: Counting Capacitor Circuits.

Problem
Submissions
Leaderboard
Discussions

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

An electric circuit uses exclusively identical capacitors of the same value .

The capacitors can be connected in series or in parallel to form sub-units, which can then be connected in series or in parallel with other capacitors or other sub-units to form larger sub-units, and so on up to a final circuit.

Using this simple procedure and up to identical capacitors, we can make circuits having a range of different total capacitances. For example, using up to capacitors of each, we can obtain the following distinct total capacitance values:

If we denote by the number of distinct total capacitance values we can obtain when using up to equal-valued capacitors and the simple procedure described above, we have: ...

Find .

Reminder : When connecting capacitors , etc in parallel, the total capacitance is , whereas when connecting them in series, the overall capacitance is given by:

Input Format

Each test file contains a single integer .

Constraints

Output Format

Output a single number i.e.

Sample Input

3

Sample Output

7

Author

bayleef

Difficulty

Easy

Max Score

100

Submitted By

1721

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