Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #11 Oct 22 2018 14:08:17
%S 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,
%T 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,
%U 7,13,13,16,10,7,10
%N 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.
%C Sequences with an analogous condition a(n+1) = a(n) + s for s != 3 tend towards repetitive patterns:
%C for even values of s this is obvious, e.g.:
%C s = 2: 1,1,1,3,1,3,1,3,... (1,3 repeats)
%C s = 4: 1,1,1,1,1,5,1,5,1,5,1,5,... (1,5 repeats)
%C for odd values of s it has been checked up to s <= 19:
%C 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)
%C s = 5: settles to a repetitive pattern of 192 terms
%C s = 7: settles to a repetitive pattern of 25 terms
%C s = 9: settles to a repetitive pattern of 31 terms
%C s = 11: settles to a repetitive pattern of 37 terms
%C s = 13: settles to a repetitive pattern of 43 terms
%C s = 15: settles to a repetitive pattern of 49 terms
%C s = 17: settles to a repetitive pattern of 55 terms
%C s = 19: settles to a repetitive pattern of 61 terms
%C It appears that for further values of s such sequences settle to a repetitive pattern of 4 + 3*s terms.
%H Rok Cestnik, <a href="/A318281/b318281.txt">Table of n, a(n) for n = 1..9999</a>
%e a(5) = a(4) + 3 = 4, because a(3) == a(4).
%e a(6) = a(5-a(5)) = a(1) = 1, because a(4) != a(5).
%o (C)
%o #include<stdio.h>
%o #include<stdlib.h>
%o #include<math.h>
%o int main(void){
%o int N = 100; //number of terms
%o int *a = (int*)malloc((N+1)*sizeof(int));
%o printf("1 1\n2 1\n3 1\n4 1\n");
%o a[1] = 1;
%o a[2] = 1;
%o a[3] = 1;
%o a[4] = 1;
%o for(int i = 4; i < N; ++i){
%o if(a[i-1] != a[i]) a[i+1] = a[i-a[i]];
%o else a[i+1] = a[i]+3;
%o printf("%d %d\n", i+1, a[i+1]);
%o }
%o free(a);
%o return 0;
%o }
%Y See A318282 for (a(n)-1)/3.
%Y Cf. A281130, A291598, A004001, A005085, A005229.
%K nonn
%O 1,5
%A _Rok Cestnik_, Aug 23 2018