Sorry that this is a long question; the crux of it is that I want to know why lines appear in the graph of the function ($\varphi^\infty(x)$) I've defined.
Define $\varphi(x)$ as follows: If the decimal representation of $x\in \mathbb{R}$ is $x=\sum\limits_{n=-\infty}^\infty a_n 10^n$ where $a_n\in\{0,1,2,...,9\}$ and $|\{a_n\;|\;n>0\}|$ is finite let:
$$\varphi(x)=\sum_{n=-\infty}^\infty a_n\left(\max{\{a_k\;|\;k\in\mathbb{N}\}}+1\right)^n$$
(i.e. read $x$'s base $10$ expansion as if it is written in base $1+\max{\{a_k\}}$). Then let $\varphi^\infty(x)$ be the value obtained by repeated applications of $\varphi(x)$ until a stable value is reached (if it exists), i.e. $\varphi^\infty(x)=\varphi(\varphi(...(\varphi(x))...))$. To illustrate, $\varphi(57)=57_8=47_{10}$, so $\varphi(57)=47$, and $\varphi(47)=47_8=39_{10}$ so $\varphi(47)=39$, and $\varphi(39)=39_{10}$, so no further applications of $\varphi(x)$ will change it, so $\varphi^\infty(57)=39$. Similarly $\varphi(\frac{1}{3})=0.333..._4=1$ and $\varphi(1)=1$ so $\varphi^\infty(\frac{1}{3})=1$. For any number $y$ with $9$ in its decimal expansion we will obviously have $\varphi(y)=\varphi^\infty(y)=y$; $\varphi^\infty(x)$ seems mathematically irrelevant, but it interests me; when graphed for integer $x$, we get linear patterns.
Graphs of $\varphi^\infty(x)$ at integer $x$ over increasing domains (full size versions here and here and here and here):
The top line (slope $1$) is numbers containing a $9$; but there are lines of other slopes below (one in red); the following zooms show they are made up of smaller line segments of different slopes.
Graphs of $\varphi^\infty(x)$ at integer $x$; the first shows the boxed area above, the second is a zoom for large $x$, and the third is a zoom into one of the line segments in the previous graph (full size versions here and here and here):
At the smallest scale line segments with slope $1$ will occur; this can be seen in $\varphi(x)$ which displays the same pattern (I have only focused on $\varphi^\infty(x)$ because the lines are more obvious).
Graphs of $\varphi(x)$ at integer $x$ over increasing domains (full size versions here and here and here):
I cannot explain why the points (which on the small scale form short lines of slope $1$) on the large scale arrange themselves approximately into lines of varying slopes passing through the origin. Why do the values of $\varphi^\infty(x)$ and $\varphi(x)$ approximately fit onto clear lines like the ones highlighted above?
I don't know if similar lines occur for non-integer $x$; points where $\varphi^\infty(x)$ is continuous are obviously dense in $\mathbb{R}$; I can't see a good way of plotting $\varphi(x)$ for real $x$ ($\varphi(\frac{2}{3})=0.666..._7=1$ but a computer might give $\varphi(\frac{2}{3})=0.666...7_8\overset{!}{=}0.857..._{10}$). It exists for all integer $x$, but I can't prove $\varphi^\infty(x)$ exists for all $x$ (for some $x$, we might never get a number with $9$ in the decimal expansion).
But my main question is the following: Can anyone explain why the approximations to lines passing through the origin occur in the above graphs? What determines the slope of the lines?
The above graphs were generated by the following python script:
from __future__ import division
from pylab import *
from fractions import Fraction
def phi(number):
number=float(number); number=str(number); digits=[]
for dig in number:
digits.append(dig)
digitstest=digits; digitstest.remove('.'); m=int(max(digitstest))+1
firstdigs=[]
for dig in number:
if dig=='.':
break
firstdigs.append(int(dig))
y=0; k=size(firstdigs)-1; n=k
while n-k









