login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A272265 Number of n-step tri-directional self-avoiding walks on the hexagonal lattice. 1

%I #35 Dec 11 2018 02:05:58

%S 1,3,9,21,51,123,285,669,1569,3603,8343,19335,44193,101577,233697,

%T 532569,1218345,2789475,6343161,14464101,33004269,74923059,170440203,

%U 387945747,879473277,1997066751,4536975315,10273846185

%N Number of n-step tri-directional self-avoiding walks on the hexagonal lattice.

%C Only 3 directions are allowed, separated by 120 degrees.

%C o

%C x

%C o o

%t mo={{2, 0},{-1, 1}, {-1, -1}}; a[0]=1;

%t a[tg_, p_:{{0, 0}}] := Block[{e, mv = Complement[Last[p]+# & /@ mo, p]}, If[tg == 1, Length@mv, Sum[a[tg-1, Append[p, e]], {e, mv}]]];

%t a /@ Range[0, 10]

%t (* _Robert FERREOL_, Nov 28 2018; after the program of Giovanni Resta in A001411 *)

%o (Python)

%o def add(L,x):

%o ... M=[y for y in L];M.append(x)

%o ... return(M)

%o plus=lambda L,M : [x+y for x,y in zip(L,M)]

%o mo=[[2,0],[-1,1],[-1, -1]]

%o def a(n,P=[[0, 0]]):

%o ... if n==0: return(1)

%o ... mv1 = [plus(P[-1],x) for x in mo]

%o ... mv2=[x for x in mv1 if x not in P]

%o ... if n==1: return(len(mv2))

%o ... else: return(sum(a(n-1,add(P,x)) for x in mv2))

%o [a(n) for n in range(11)]

%o # _Robert FERREOL_, Nov 30 2018

%Y Cf. A001334.

%K nonn,walk

%O 0,2

%A _Francois Alcover_, May 05 2016

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 20:26 EDT 2024. Contains 371781 sequences. (Running on oeis4.)