Problem p03212 - Generation 1

Orig Description

Score : 300 points
Problem StatementYou are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally "Seven-Five-Three numbers") are there?
Here, a Shichi-Go-San number is a positive integer that satisfies the following condition:
When the number is written in base ten, each of the digits 7, 5 and 3 appears at least once, and the other digits never appear.
Constraints
1 \leq N < 10^9
N is an integer.
InputInput is given from Standard Input in the following format:
N
OutputPrint the number of the Shichi-Go-San numbers between 1 and N (inclusive).
Sample Input 1575
Sample Output 14
There are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.
Sample Input 23600
Sample Output 213
There are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.
Sample Input 3999999999
Sample Output 326484

Extracted Specification

Canonicalized Input Description:

An integer X (1 ≤ X < 10^9).

### Example Input:

```
575
```

### Function Signature:
Write a function f(X) that takes in the input.
def f(X: int):
    ''' 
    X: an integer
    '''

Test Case Generator

Certainly! Below is a test case generator for the problem statement that counts the number of Shichi-Go-San numbers between 1 and N.

### Test Case Generator

```python
import random

def tcgen():
    N = random.randint(1, 10**9)
    return N

# Example usage:
print(tcgen())
```

### Explanation of the Generator

1. **Random Integer Generation**: The generator will produce a single integer \( N \) within the specified range \( 1 \leq N < 10^9 \).
2. **Output**: The function returns this integer \( N \) which then can be used as an input to the solution function.

### Example Outputs from the Generator

Here are a few example outputs that the generator might produce:

- 52346789
- 1000000
- 987654321

You can use these generated test cases to check the correctness and performance of your solution for the Shichi-Go-San numbers problem.

### Python Script to Run the Generator

```python
import random

def tcgen():
    N = random.randint(1, 10**9)
    return N

if __name__ == "__main__":
    # Generate and print a test case
    test_case = tcgen()
    print(test_case)
```

This script will generate a random test case each time it's run, which can help in thorough testing of the solution to ensure it works for a wide range of inputs.

Extract Arguments

def extract_arguments(fh):
    N = int(fh.readline().strip())
    return N