A137822 First differences of A137821 (numbers such that sum( Catalan(k), k=1..2n) = 0 (mod 3)).
1, 3, 2, 7, 2, 3, 1, 21, 2, 3, 1, 8, 1, 3, 2, 61, 2, 3, 1, 8, 1, 3, 2, 21, 1, 3, 2, 7, 2, 3, 1, 183, 2, 3, 1, 8, 1, 3, 2, 21, 1, 3, 2, 7, 2, 3, 1, 62, 1, 3, 2, 7, 2, 3, 1, 21, 2, 3, 1, 8, 1, 3, 2, 547, 2, 3, 1, 8, 1, 3, 2, 21, 1, 3, 2, 7, 2, 3, 1, 62, 1, 3, 2, 7, 2, 3, 1, 21, 2, 3, 1, 8, 1, 3, 2, 183, 1, 3, 2
Offset: 1
Keywords
Examples
Record values are a(1)=1, a(2)=3, a(4)=7, a(8)=21, a(16)=61, ... Apart from these values, the only other values occurring in the sequence are: 2=a(1)+1=a(3*1), 8=a(4)+1=a(3*4), 62=a(16)+1=a(3*16), ...
Links
- M. F. Hasler, Table of n, a(n) for n = 1..499.
Programs
-
Mathematica
Join[{1},Differences[Flatten[Position[Accumulate[CatalanNumber[Range[3000]]],?(Mod[#,3]==0&)]]/2]] (* _Harvey P. Dale, Jun 19 2025 *)
-
PARI
A137822 = D( A137821 ) /* where D(v)=vector(#v-1,i,v[i+1]-v[i]) or D(v)=vecextract(v, "^1")-vecextract(v,"^-1") */
-
PARI
n=0; A137822=vector(499,i,{ o=n; if( bitand(i,i-1), while(n++ && s+=binomial(4*n-2, 2*n-1)/(2*n)*(10*n-1)/(2*n+1),),s=Mod(0,3); n=2*n+1+log(i+.5)\log(2)%2 ); n-o})
-
PARI
A137822(n)= local( L=log(n+.5)\log(2) ); while( n>0 || ((n+=2^L) && L=log(n+.5)\log(2)), (n-=2^L) || return( 3^(L+1)\4+1 ); (n-=2^(L-1)) || return( 3^L\4+1+L%2 );n<0 && n+=2<
M. F. Hasler, Mar 15 2008
Comments