Let $n$ and $m$ be natural numbers such that $m+ i=a_ib_i^2$ for $i=1,2, \cdots n$ where $a_i$ and $b_i$ are natural numbers and $a_i$ is not divisible by a square of a prime number.
Find all $n$ for which there exists an $m$ such that 
$\sum_{i=1}^{n}a_i=12$
1. **Understanding the Problem:**
   We are given natural numbers \( n \) and \( m \) such that \( m + i = a_i b_i^2 \) for \( i = 1, 2, \ldots, n \), where \( a_i \) and \( b_i \) are natural numbers and \( a_i \) is not divisible by a square of a prime number. We need to find all \( n \) for which there exists an \( m \) such that \(\sum_{i=1}^{n} a_i = 12\).

2. **Initial Constraints:**
   - \( a_i \) is square-free.
   - \( a_i \) and \( b_i \) are natural numbers.
   - \( \sum_{i=1}^{n} a_i = 12 \).

3. **Analyzing \( n = 1 \):**
   - If \( n = 1 \), then \( a_1 = 12 \). However, 12 is not square-free (since \( 12 = 2^2 \cdot 3 \)). Therefore, \( n \neq 1 \).

4. **Analyzing \( n \geq 13 \):**
   - If \( n \geq 13 \), then among 12 consecutive integers, at most 3 can be perfect squares. This implies that at least \( n - 3 \) of the \( a_i \)'s are at least 2.
   - Therefore, \(\sum_{i=1}^{n} a_i \geq 2(n - 3) + 3 = 2n - 3 \geq 13 > 12\). Hence, \( n \geq 13 \) is not possible.

5. **Analyzing \( 8 \leq n \leq 12 \):**
   - Similar to the previous step, at least \( n - 3 \) of the \( a_i \)'s are at least 2.
   - Therefore, \(\sum_{i=1}^{n} a_i \geq 2(n - 3) + 3 = 2n - 3 \geq 13 > 12\). Hence, \( 8 \leq n \leq 12 \) is not possible.

6. **Analyzing \( n \leq 7 \):**
   - We need to check if there are any valid combinations of \( a_i \) such that \(\sum_{i=1}^{n} a_i = 12\).

7. **Observation:**
   - All \( a_i \)'s must be distinct. If not, we would have \( 6 \geq n - 1 \geq (m + j) - (m + i) = a(b_j^2 - b_i^2) \geq 3a \), forcing \( a = 2 \) or \( a = 1 \), leading to contradictions as shown in the solution.

8. **Possible Values for \( n \):**
   - Since each \( a_i \) is \( 1, 2, 3, 5, 6 \) or more, and \( 1 + 2 + 3 + 5 + 6 > 12 \), we must have \( n \leq 4 \).

9. **Checking \( n = 2 \):**
   - A possibility is \( a_1 = 1 \), \( a_2 = 11 \).
   - Example: \( m = 98 \) (since \( 99 = 11 \cdot 3^2 \) and \( 100 = 1 \cdot 10^2 \)).

10. **Checking \( n = 3 \):**
    - A possibility is \( a_1 = 1 \), \( a_2 = 5 \), \( a_3 = 6 \).
    - Example: \( m = 3 \) (since \( 4 = 1 \cdot 2^2 \), \( 5 = 5 \cdot 1^2 \), \( 6 = 6 \cdot 1^2 \)).

11. **Checking \( n = 4 \):**
    - The only possibility is \( a_1, a_2, a_3, a_4 \) to be \( 1, 2, 3, 6 \) in some order.
    - However, \((m+1)(m+2)(m+3)(m+4) = (6K)^2\) for some integer \( K \), but the left-hand side is \((m^2 + 5m + 4)(m^2 + 5m + 6) = (m^2 + 5m + 5)^2 - 1\) and is hence not a square.

Therefore, the only possible \( n \) are \( 2 \) and \( 3 \).

The final answer is \( \boxed{ n = 2 } \) and \( n = 3 \).