Affine Recurrence and First Threshold
Affine Recurrence and First Threshold
Calculate a term and cumulative sum of an affine recurrence, or find its first threshold crossing from index zero.
- 187 bytes
- COMP mode
Worked examples
Example 1
Original exercise. For the recurrence indexed from n=0, find the requested term and sum, or the first admissible index within the stated search range. x₀=10; xₙ₊₁=2xₙ+3; n=3. x₃=?, Σ(j=0…3)xⱼ=?
Answer
Standard solution (without a calculator)
- Substitute the conditions, solve the equations, then retain only values satisfying the stated domain.
- Equation: x₁=2×10+3=23; x₂=49; x₃=101.
- Calculation: Σ=10+23+49+101=183.
- Conclusion: x₃=101; Σ=183.
Example 2
Original exercise. For the recurrence indexed from n=0, find the requested term and sum, or the first admissible index within the stated search range. x₀=0; xₙ₊₁=2xₙ+1; 0≤n≤10, n∈ℤ. min{n:xₙ≥15}=?
Answer
Standard solution (without a calculator)
- Substitute the conditions, solve the equations, then retain only values satisfying the stated domain.
- Equation: xₙ+1=2ⁿ ⇒ xₙ=2ⁿ−1.
- Calculation: x₃=7<15; x₄=15.
- Conclusion: min n=4; x₄=15.
Example 3
Original exercise. For the recurrence indexed from n=0, find the requested term and sum, or the first admissible index within the stated search range. x₀=0; xₙ₊₁=xₙ/2+5; 0≤n≤70, n∈ℤ. min{n:xₙ≥10}=?
Answer
Standard solution (without a calculator)
- Substitute the conditions, solve the equations, then retain only values satisfying the stated domain.
- Equation: 10−xₙ=10×2^(−n) ⇒ xₙ=10(1−2^(−n)).
- Calculation: 2^(−n)>0 ⇒ xₙ<10.
- Conclusion: ∅ (0≤n≤70).
When to use it
Calculate a term and cumulative sum of an affine recurrence, or find its first threshold crossing from index zero.
Input order
- A:x₀ → B:r → C:c → M:1 → D:n
- A:x₀ → B:r → C:c → M:2 → Y:T → D:Nmax
- Enter all fields again for every run. Blank EXE retains old memory; zero must be typed as 0EXE.
Results
- xₙ → Σ(j=0…n)xⱼ
- n → xₙ
- All displayed values follow the output order below. A pause requires EXE; the final screen uses AC.
Conditions and limits
- Enter x₀,r,c,M; mode 1 then asks n, while modes 2/3 ask T and Nmax. Mode 1 returns xₙ and x₀+…+xₙ; 2 searches xₙ≥T, 3 searches xₙ>T, including n=0. Use nonnegative integer n or Nmax. −1,−1 means no hit in the chosen range; −2,−2 means invalid mode or negative limit. A question’s first year corresponds to n=0; convert indices accordingly. This does not search cumulative sums. All seven variables and Ans are overwritten.
- The finite precision and numeric range of the calculator limit very large, very small or nearly cancelling values.
Checking access…