The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A215577 Number of nonintersecting (or self-avoiding) rook paths joining opposite corner cells of an n X n X n grid, avoiding cells that are not on the surface. 0
1, 18, 340812, 1553113040 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
When n<3 there are n^3 cells available, otherwise n^3 - (n-2)^3.
The length of the step is 1. The length of the path varies.
LINKS
PROG
(C)
#include <stdio.h> // GCC -O3
char grid[4][4][4];
long long SIZE;
long long calc_ways(long long x, long long y, long long z) {
long long n;
if (grid[x][y][z]) return 0;
if (x+y+z==SIZE*3-3) return 1;
grid[x][y][z]=1;
n=0;
if (x>0) n =calc_ways(x-1, y, z); // go left
if (x<SIZE-1) n+=calc_ways(x+1, y, z); // right
if (y>0) n+=calc_ways(x, y-1, z); // down
if (y<SIZE-1) n+=calc_ways(x, y+1, z); // up
if (z>0) n+=calc_ways(x, y, z-1); // level down
if (z<SIZE-1) n+=calc_ways(x, y, z+1); // level up
grid[x][y][z]=0;
return n;
}
int main()
{
for (SIZE=1; SIZE<=4; ++SIZE) {
int x, y, z;
memset(grid, 0, sizeof(grid));
for (x=1; x<SIZE-1; ++x)
for (y=1; y<SIZE-1; ++y)
for (z=1; z<SIZE-1; ++z)
grid[x][y][z]=1;
printf("%llu, ", calc_ways(0, 0, 0));
}
}
CROSSREFS
Sequence in context: A259364 A013762 A078352 * A071098 A259164 A013808
KEYWORD
nonn,walk,more
AUTHOR
Alex Ratushnyak, Aug 16 2012
STATUS
approved

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 June 16 08:45 EDT 2024. Contains 373424 sequences. (Running on oeis4.)