#K63702. Digit Square Sum Sequence

    ID: 31812 Type: Default 1000ms 256MiB

Digit Square Sum Sequence

Digit Square Sum Sequence

You are given a positive integer (k). Construct a sequence of (k) terms where the first term is (1) and each subsequent term is defined as the sum of the squares of the digits of the previous term. Formally, let (a_1 = 1) and for (n \geq 2), (a_n = \sum_{d \in \text{digits}(a_{n-1})} d^2). For this problem, notice that since (a_1 = 1), all subsequent terms will also be (1). Your task is to output the sequence of (k) numbers on a single line separated by a space.

inputFormat

The input consists of a single integer (k) ((1 \leq k \leq 10^5)). This integer is read from standard input (stdin).

outputFormat

Output exactly (k) integers on one line separated by a single space where each integer is a term in the sequence. The output should be printed to standard output (stdout).## sample

1
1