login
A318281
a(n+1) = a(n-a(n)) if a(n-1) != a(n), otherwise a(n+1) = a(n) + 3; a(1) = a(2) = a(3) = a(4) = 1.
3
1, 1, 1, 1, 4, 1, 4, 1, 4, 4, 7, 1, 7, 1, 7, 1, 7, 4, 1, 4, 1, 4, 4, 7, 7, 10, 1, 10, 4, 7, 4, 1, 4, 4, 7, 10, 10, 13, 7, 1, 7, 4, 13, 7, 10, 7, 7, 10, 13, 10, 1, 10, 4, 13, 7, 10, 7, 10, 10, 13, 7, 13, 13, 16, 10, 7, 10
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.
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
See A318282 for (a(n)-1)/3.
Sequence in context: A240226 A322515 A330571 * A126114 A323458 A074393
KEYWORD
nonn
AUTHOR
Rok Cestnik, Aug 23 2018
STATUS
approved