# EDITED A107755 (improved)

Maximilian Hasler maximilian.hasler at gmail.com
Mon Feb 25 18:29:00 CET 2008

```I suggest the following edit, where the bad %Y is deleted and a link
for Richard's b-file, my comment and PARI code (improved),
and Richard's Maple code
^^^^^^^^^^^^^^
(sorry, I first used my draft written yesterday...) are already included.

Maximilian

PS: I also changed my PARI code to calculate the sum in Z/3Z, not
always anew from k=1, and using my %F - now I can reproduce Richard's
values up to 20774 in 50" (with 2 mprime in the background...).
Further speedup might be possible by (a) calculating Catalan(k) mod 3,
(b) exploiting in more detail the idea of the %F to avoid also the
smaller gaps,
(c) using a totally explicit formula ;-).

%I A107755
%S A107755 2,8,12,26,30,36,38,80,84,90,92,108,110,116,120,242,246,252,254,270,272,
%T A107755 278,282,324,326,332,336,350,354,360,362,728,732,738,740,756,758,764,
%U A107755 768,810,812,818,822,836,840,846,848,972,974,980,984,998,1002,1008,1010
%N A107755 Numbers n such that Sum_{k=1..n} Catalan(k) == 0 mod 3.
%D A107755 Y. More, Problem 11165, Amer. Math. Monthly, 112 (2005), 568.
%F A107755 a(2^j) = 2*a(2^j-1)+2 (resp.+4) if j is even (resp. odd). -
M. Hasler, Feb 25 2008
%H A107755 R. J. Mathar, <a
href="http://www.research.att.com/~njas/sequences/b107755.txt">
Table of n, a(n) for n=1,...,319</a>.
%p A107755
A107755 := proc(n) option remember ;
local a;
if n = 1 then
2;
else
for a from A107755(n-1)+1 do
if add(A000108(k),k=1..a) mod 3 = 0 then
RETURN(a) ;
fi ;
od:
fi ;
end: # - R. J. Mathar, Feb 25 2008
%p A107755 c:=n->binomial(2*n,n)/(n+1): s:=0: for n from 1 to 1500 do
s:=s+c(n): a[n]:=s mod
3: od: A:=[seq(a[n],n=1..1500)]: p:=proc(n) if A[n]=0
then n else
fi end: seq(p(n),n=1..1500); (Deutsch)
%t A107755 s0 = s2 = {}; s = 0; Do[s = Mod[s + (2 n)!/n!/(n + 1)!, 3];
Switch[ Mod[s, 3], 0,
AppendTo[s0, n], 2, AppendTo[s2, n]], {n, 1055}]; s0
(from Robert
G. Wilson v (rgwv(AT)rgwv.com), Jun 14 2005)
%o A107755 (PARI) n=0; s=Mod(0,3); A107755=vector(100,i,{
if( bitand(i,i-1), while(n++&s+=binomial(2*n,n)/(n+1),),
s=Mod(0,3);n=2*n+2+(log(i+.5)\log(2)%2)*2 ); /*print1(n",");*/ n)} \\
- M.Hasler, Feb 25 2008
%Y A107755 Cf. A000108, A107756, A107757, A108784.
%Y A107755 Sequence in context: A063622 A013654 A108978 this_sequence
A027718 A115102 A047174
%Y A107755 Adjacent sequences: A107752 A107753 A107754 this_sequence
A107756 A107757 A107758
%K A107755 nonn,easy
%O A107755 1,1
%A A107755 njas, Jun 11 2005
%E A107755 More terms from Emeric Deutsch (deutsch(AT)duke.poly.edu),
Jun 12 2005
%E A107755 Corrected & extended by Maximilian F. Hasler
(MHasler(AT)univ-ag.fr) and Richard J. Mathar
(mathar(AT)strw.leidenuniv.nl), Feb 25 2008

```