I made a small animation sketch in Processing, visualising the properties of the Rećaman integers sequnce.
This is only a snapshot.
Color represents whether a number is achieved with a jump backwards or forwards,
Radius of the arc is the size of the jump, and rotation frequency is relative to the jump size too.
For aesthetics reasons I used only the first 18 terms of the sequnce.
here’s the code:
IntList ser = new IntList();
int mxjmp = 18;
float scl = 33.0;
float rt = 0.0;
Boolean notBack;
void setup() {
size(1500, 1000,P3D);
strokeWeight(3);
rectMode(CENTER);
background(0);
initSer();
}
void draw() {
pushMatrix();
fill(0, 10);
noStroke();
translate(width/2, height/2, -400);
rect(0, 0, width*2, height*2);
popMatrix();
for (int i=0; i<ser.size()-1; i++)
{
float yy = scl* (ser.get(i+1)+ser.get(i))/2;
float rr = scl* abs( ser.get(i+1)-ser.get(i));
noFill();
stroke(255, ser.get(i+1)-ser.get(i)>0?255:100, ser.get(i+1)-ser.get(i)>0?255:0,100);
pushMatrix();
translate(width/2, 60);
rotateY(rt*300/(1+i));
arc(0, yy, rr, rr, HALF_PI+(i%2)*PI, HALF_PI+PI+(i%2)*PI);
popMatrix();
}
rt+=0.00075;
}
void initSer() {
int jmp = 1;
ser = new IntList();
ser.append(0);
while (jmp<mxjmp)
{
check(ser.get(ser.size()-1)-jmp);
if (notBack) ser.append(ser.get(ser.size()-1)+jmp);
else ser.append(ser.get(ser.size()-1)-jmp);
jmp++;
}
}
void check(int h_)
{
notBack=false;
for (int i=0; i<ser.size(); i++)
if (ser.get(i)==h_ || h_<0) notBack=true;
}