## Project Euler 197: Investigating the behavior of a recursively defined sequence

#### Problem Description

Given is the function `f`(`x`) = ⌊2^{30.403243784-x2}⌋ × 10^{-9} ( ⌊ ⌋ 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.

#### Analysis

We first made a plot of this function to see what we were dealing with. It seemed to oscillate and converge very quickly bouncing back and forth between 0.6811… and 1.0294… ad infinitum. This means that instead of 10^{12} iterations only a few hundred are required.

#### Project Euler 197 Solution

Runs < 0.001 seconds in Python 2.7.Use this link to get the Project Euler 197 Solution Python 2.7 source.

#### Answer

Slowly swipe from either end beginning with the white vertical bar to get an idea of the starting or ending digits. For less drama, just double click the answer area. The distance between the two bars will give you an idea of the magnitude. Touch devices can tap and hold the center of the box between the two bars and choose*define*to reveal the answer.

|1.710637717|

#### Afterthoughts

- The step size of 51 was arbitrary and could be any odd number. The bigger the step size the faster the solution (fewer iterations) but the deeper the level of recursion.
- Graph of relation via Mathematica showing “ringing bell” pattern

*Project Euler 197 Solution last updated*

## Discussion

## No comments yet.