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!)
A333466 Number of self-avoiding closed paths on an n X n grid which pass through four corners ((0,0), (0,n-1), (n-1,n-1), (n-1,0)). 9

%I #37 Apr 07 2020 10:38:21

%S 1,1,11,373,44930,17720400,22013629316,84579095455492

%N Number of self-avoiding closed paths on an n X n grid which pass through four corners ((0,0), (0,n-1), (n-1,n-1), (n-1,0)).

%C a(11) = 36061721109572407840288. - _Seiichi Manyama_, Apr 07 2020

%e a(2) = 1;

%e +--+

%e | |

%e +--+

%e a(3) = 1;

%e +--*--+

%e | |

%e * *

%e | |

%e +--*--+

%e a(4) = 11;

%e +--*--*--+ +--*--*--+ +--*--*--+

%e | | | | | |

%e *--*--* * *--* *--* *--* *

%e | | | | | |

%e *--*--* * *--* *--* *--* *

%e | | | | | |

%e +--*--*--+ +--*--*--+ +--*--*--+

%e +--*--*--+ +--*--*--+ +--*--*--+

%e | | | | | |

%e * *--*--* * *--* * * *--*

%e | | | | | | | |

%e * *--*--* * * * * * *--*

%e | | | | | | | |

%e +--*--*--+ +--* *--+ +--*--*--+

%e +--*--*--+ +--*--*--+ +--* *--+

%e | | | | | | | |

%e * * * * * *--* *

%e | | | | | |

%e * *--* * * * * *--* *

%e | | | | | | | | | |

%e +--* *--+ +--*--*--+ +--* *--+

%e +--* *--+ +--* *--+

%e | | | | | | | |

%e * *--* * * * * *

%e | | | | | |

%e * * * *--* *

%e | | | |

%e +--*--*--+ +--*--*--+

%o (Python)

%o # Using graphillion

%o from graphillion import GraphSet

%o import graphillion.tutorial as tl

%o def A333466(n):

%o universe = tl.grid(n - 1, n - 1)

%o GraphSet.set_universe(universe)

%o cycles = GraphSet.cycles()

%o for i in [1, n, n * (n - 1) + 1, n * n]:

%o cycles = cycles.including(i)

%o return cycles.len()

%o print([A333466(n) for n in range(2, 10)])

%o (Ruby)

%o def search(x, y, n, used)

%o return 0 if x < 0 || n <= x || y < 0 || n <= y || used[x + y * n]

%o return 1 if x == 0 && y == 1 && [n - 1, n * (n - 1), n * n - 1].all?{|i| used[i] == true}

%o cnt = 0

%o used[x + y * n] = true

%o @move.each{|mo|

%o cnt += search(x + mo[0], y + mo[1], n, used)

%o }

%o used[x + y * n] = false

%o cnt

%o end

%o def A(n)

%o return 1 if n < 3

%o @move = [[1, 0], [-1, 0], [0, 1], [0, -1]]

%o used = Array.new(n * n, false)

%o search(0, 0, n, used)

%o end

%o def A333466(n)

%o (2..n).map{|i| A(i)}

%o end

%o p A333466(6)

%Y Main diagonal of A333513.

%Y Cf. A003763, A140517, A333246, A333247, A333323.

%K nonn,more

%O 2,3

%A _Seiichi Manyama_, Mar 22 2020

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 25 10:01 EDT 2024. Contains 371967 sequences. (Running on oeis4.)