6 kyu

Button Quest: Path to N

Description:

Your friend has discovered an old machine that performs simple mathematical operations. The machine has only two buttons:

+1 — adds one to the current number.

x2 — multiplies the current number by two.

The machine starts with the number 1. Now, your friend wants to know how many different ways it is possible to obtain a given number n using these buttons. Help them write a program that calculates this number.

Constraint: 1 ≤ n ≤ 10**6

Stats:

CreatedJan 1, 2025
PublishedJan 1, 2025
Warriors Trained137
Total Skips2
Total Code Submissions311
Total Times Completed55
Python Completions55
Total Stars3
% of votes with a positive feedback rating87% of 15
Total "Very Satisfied" Votes11
Total "Somewhat Satisfied" Votes4
Total "Not Satisfied" Votes0
Total Rank Assessments11
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • IvanKalug-QA Avatar
  • dfhwze Avatar
Ad