login
A318282
a(n) = (A318281(n) - 1)/3.
2
0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 2, 0, 2, 0, 2, 0, 2, 1, 0, 1, 0, 1, 1, 2, 2, 3, 0, 3, 1, 2, 1, 0, 1, 1, 2, 3, 3, 4, 2, 0, 2, 1, 4, 2, 3, 2, 2, 3, 4, 3, 0, 3, 1, 4, 2, 3, 2, 3, 3, 4, 2, 4, 4, 5, 3, 2, 3, 2, 2, 3, 4, 3, 4, 4, 5
OFFSET
1,11
LINKS
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 0\n2 0\n3 0\n4 0\n");
a[1] = 0;
a[2] = 0;
a[3] = 0;
a[4] = 0;
for(int i = 4; i < N; ++i){
if(a[i-1] != a[i]) a[i+1] = a[i-(3*a[i]+1)];
else a[i+1] = a[i]+1;
printf("%d %d\n", i+1, a[i+1]);
}
free(a);
return 0;
}
CROSSREFS
KEYWORD
nonn
AUTHOR
Rok Cestnik, Aug 23 2018
STATUS
approved