OFFSET
1,5
COMMENTS
Sequences with an analogous condition a(n+1) = a(n) + s for s != 3 tend towards repetitive patterns:
for even values of s this is obvious, e.g.:
s = 2: 1,1,1,3,1,3,1,3,... (1,3 repeats)
s = 4: 1,1,1,1,1,5,1,5,1,5,1,5,... (1,5 repeats)
for odd values of s it has been checked up to s <= 19:
s = 1: 1,1,2,1,2,2,3,1,3,2,1,2,2,3,1,3,... (2,1,2,2,3,1,3 repeats)
s = 5: settles to a repetitive pattern of 192 terms
s = 7: settles to a repetitive pattern of 25 terms
s = 9: settles to a repetitive pattern of 31 terms
s = 11: settles to a repetitive pattern of 37 terms
s = 13: settles to a repetitive pattern of 43 terms
s = 15: settles to a repetitive pattern of 49 terms
s = 17: settles to a repetitive pattern of 55 terms
s = 19: settles to a repetitive pattern of 61 terms
It appears that for further values of s such sequences settle to a repetitive pattern of 4 + 3*s terms.
LINKS
Rok Cestnik, Table of n, a(n) for n = 1..9999
EXAMPLE
a(5) = a(4) + 3 = 4, because a(3) == a(4).
a(6) = a(5-a(5)) = a(1) = 1, because a(4) != a(5).
PROG
(C)
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(void){
int N = 100; //number of terms
int *a = (int*)malloc((N+1)*sizeof(int));
printf("1 1\n2 1\n3 1\n4 1\n");
a[1] = 1;
a[2] = 1;
a[3] = 1;
a[4] = 1;
for(int i = 4; i < N; ++i){
if(a[i-1] != a[i]) a[i+1] = a[i-a[i]];
else a[i+1] = a[i]+3;
printf("%d %d\n", i+1, a[i+1]);
}
free(a);
return 0;
}
CROSSREFS
KEYWORD
nonn
AUTHOR
Rok Cestnik, Aug 23 2018
STATUS
approved