Sure, here is a test case generator for the problem "Decimal Sequences":

```python
import random

def tcgen():
    n = random.randint(1, 1000)  # n is the number of digits in the sequence
    digits = [random.randint(0, 9) for _ in range(n)]  # Generate a list of n digits, each between 0 and 9
    
    return n, digits

# Function to generate the input string in the desired format
def format_input(n, digits):
    return f"{n}\n{' '.join(map(str, digits))}"

# Example usage
n, digits = tcgen()
input_str = format_input(n, digits)
print(input_str)
```

### Explanation:

1. **Random number of digits (`n`)**: The number of digits in the sequence is randomly chosen between 1 and 1000.
2. **Digit sequence (`digits`)**: A list of `n` digits is generated, where each digit is randomly chosen between 0 and 9.
3. **Formatting the input**: The `format_input` function formats the generated data into the required input format with `n` on the first line followed by the digits separated by spaces on the second line.

Here’s how you can use this generator to produce test cases for the problem:

1. **Run `tcgen()`** to generate a random test case.
2. **Format the test case** using `format_input()` to obtain a string representation suitable for input to the problem.
3. **Print or save the generated input** for use in testing.

This approach ensures that the test cases are within the constraints specified by the problem statement and provides a variety of test cases for thorough testing.