Question 1: Generated Numbers (Unique Marbles)
Problem Statement:
You have a jar which initially contains N marbles. You can perform the following operations in any order:
Where A & B are integer values.
Your task is to find and return an integer value representing the total number of unique positive numbers of marbles that can be left behind by performing these operations, including the initial number of marbles.
Note:
Input Specification:
Output Specification:
Example 1:
Input:
input1: 4
input2: 1
input3: 2
Output:
4
Explanation:
You can take out A=1 or B=2 marbles.
The unique values you can reach are 4 (initial), 3 (taking 1), 2 (taking 2), and 1 (taking 2 then 1, or 1 three times). Output is 4.
Example 2:
Input:
input1: 10
input2: 2
input3: 5
Output:
8
Explanation:
From 10, we can reach the following positive configurations by successively subtracting 2 or 5: 10, 8, 6, 4, 2, 5, 3, and 1. Output is 8.