Investigating the Behaviour of a Recursively Defined Sequence
Given the function: f(x) = floor(2^(30.403243784 - x^2)) * 10^(-9) and the sequence u_0 = -1, u_(n+1) = f(u_n), find floor((u_n + u_(n+1)) x 10^9) for sufficiently large n (written as x.xxxxxxxxx).
Problem Statement
This archive keeps the full statement, math, and original media on the page.
Given is the function $f(x) = \lfloor 2^{30.403243784 - x^2}\rfloor \times 10^{-9}$ ($\lfloor \, \rfloor$ is the floor-function),
the sequence $u_n$ is defined by $u_0 = -1$ and $u_{n + 1} = f(u_n)$.
Find $u_n + u_{n + 1}$ for $n = 10^{12}$.
Give your answer with $9$ digits after the decimal point.
Problem 197: Investigating the Behaviour of a Recursively Defined Sequence
Mathematical Foundation
Theorem 1. (2-Cycle Convergence.) The sequence converges to a 2-cycle: there exist constants with such that and . Moreover, for all sufficiently large :
Proof. Define . We show is a contraction on a suitable interval .
Step 1: Existence of a 2-cycle. The function maps into for some constant (since is bounded). Thus , so maps to itself. By the Brouwer fixed-point theorem, has a fixed point in , giving , i.e., . Setting , we have .
Step 2: (not a fixed point). A fixed point of would require . Numerical evaluation shows no such solution exists: the equation has solutions near and , but the floor function prevents either from being exact. Instead, maps one neighbourhood to the other.
Step 3: Contraction. The derivative of at is . Ignoring the floor function (which is locally constant almost everywhere), . Numerical evaluation gives and , so . By the contraction mapping principle (Banach fixed-point theorem), exponentially.
Theorem 2. (Stability of the Sum.) For all sufficiently large , the sum is independent of the parity of :
Proof. For even : . For odd : .
Lemma 1. (Convergence Rate.) The convergence is exponentially fast. After iterations, is stable to the full precision of IEEE 754 double-precision arithmetic ( decimal digits).
Proof. The error after iterations of satisfies . With , after 100 iterations the error is bounded by , well below double precision.
Editorial
f(x) = floor(2^(30.403243784 - x^2)) * 1e-9 u_0 = -1, u_{n+1} = f(u_n) Converges to 2-cycle. Find floor((u_n + u_{n+1}) * 10^9). We iterate over i from 1 to 1000.
Pseudocode
for i from 1 to 1000
Now u_n and u_{n+1} are converged
Complexity Analysis
- Time: where iterations. Each iteration requires one floating-point exponentiation ( with hardware support).
- Space: — only two floating-point variables.
Answer
Code
Each problem page includes the exact C++ and Python source files from the local archive.
#include <bits/stdc++.h>
using namespace std;
int main() {
double u = -1.0;
for (int i = 0; i < 1000; i++)
u = floor(pow(2.0, 30.403243784 - u * u)) * 1e-9;
double u_n = u;
double u_n1 = floor(pow(2.0, 30.403243784 - u * u)) * 1e-9;
long long ans = (long long)floor((u_n + u_n1) * 1e9);
assert(ans == 1710637717LL);
cout << fixed << setprecision(9) << ans / 1e9 << endl;
return 0;
}
"""
Problem 197: Recursively Defined Sequence
f(x) = floor(2^(30.403243784 - x^2)) * 1e-9
u_0 = -1, u_{n+1} = f(u_n)
Converges to 2-cycle. Find floor((u_n + u_{n+1}) * 10^9).
"""
import math, matplotlib
def f(x):
return math.floor(2 ** (30.403243784 - x * x)) * 1e-9
def solve(N=1000):
u = -1.0
for _ in range(N):
u = f(u)
u_n = u
u_n1 = f(u)
return math.floor((u_n + u_n1) * 1e9)
def solve_brute(N=100):
"""Same algorithm, just verify convergence at different iteration counts."""
results = []
u = -1.0
for i in range(N):
u = f(u)
u_next = f(u)
results.append(math.floor((u + u_next) * 1e9))
return results
# Verify convergence
results = solve_brute(200)
assert all(r == results[-1] for r in results[50:]), "Not converged by iter 50"
answer = solve()
assert answer == 1710637717, f"Expected 1710637717, got {answer}"
print(f"{answer / 1e9:.9f}")