cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A219986 Number of n-step paths on a quartic lattice that move from (0,0,0,0) to (1,0,0,1) allowing all moves in {-1,0,1}^4 inclusive the zero move.

This page as a plain text file.
%I A219986 #18 Apr 28 2022 05:33:38
%S A219986 0,1,36,1764,92416,5267025,315630756,19684370601,1264977082944,
%T A219986 83266957255329,5588691282002500,381203015928291216,
%U A219986 26357375491548319296,1843677173726039815969,130261796682232750056900,9284172482167489217304900,666818520819487582805692416
%N A219986 Number of n-step paths on a quartic lattice that move from (0,0,0,0) to (1,0,0,1) allowing all moves in {-1,0,1}^4 inclusive the zero move.
%H A219986 Alois P. Heinz, <a href="/A219986/b219986.txt">Table of n, a(n) for n = 0..60</a>
%p A219986 b:= proc(n, p) option remember; `if`(p[4]>n, 0, `if`(n=0, 1,
%p A219986       add(add(add(add(b(n-1, sort(map(abs, p+[i, j, k, m])))
%p A219986       , i=-1..1), j=-1..1), k=-1..1), m=-1..1)))
%p A219986     end:
%p A219986 a:= n-> b(n, [0$2, 1$2]):
%p A219986 seq(a(n), n=0..20);  # _Alois P. Heinz_, Dec 02 2012
%t A219986 b[n_, p_] := b[n, p] = If[p[[4]] > n, 0, If[n == 0, 1,
%t A219986      Sum[Sum[Sum[Sum[b[n-1, Sort[Abs[ p + {i, j, k, m}]]],
%t A219986      {i, -1, 1}], {j, -1, 1}], {k, -1, 1}], {m, -1, 1}]]];
%t A219986 a[n_] := b[n, {0, 0, 1, 1}];
%t A219986 Table [a[n], {n, 0, 20}] (* _Jean-François Alcover_, Apr 28 2022, after _Alois P. Heinz_ *)
%o A219986 (JavaScript)
%o A219986 b=new Array();
%o A219986 for (i1=-1;i1<2;i1++)
%o A219986 for (i2=-1;i2<2;i2++)
%o A219986 for (i3=-1;i3<2;i3++)
%o A219986 for (i4=-1;i4<2;i4++) {
%o A219986 n=(i1+1)+(i2+1)*3+(i3+1)*9+(i4+1)*27;
%o A219986 b[n]=[i1,i2,i3,i4];
%o A219986 }
%o A219986 function inc(arr,m) {
%o A219986 al=arr.length-1;
%o A219986 full=true;
%o A219986 for (ac=0;ac<=al;ac++) if (arr[ac]!=m) {full=false;break;}
%o A219986 if (full==true) return false;
%o A219986 while (arr[al]==m && al>0) {arr[al]=0;al--;}
%o A219986 arr[al]++;
%o A219986 return true;
%o A219986 }
%o A219986 for (k=0;k<5;k++) {
%o A219986 c=0;
%o A219986 a=new Array();
%o A219986 for (i=0;i<k;i++) a[i]=0;
%o A219986 for (i=0;i<Math.pow(81,k);i++) {
%o A219986 p=[0,0,0,0];
%o A219986 for (j=0;j<k;j++) {p[0]+=b[a[j]][0];p[1]+=b[a[j]][1];p[2]+=b[a[j]][2];p[3]+=b[a[j]][3];}
%o A219986 if (p[0]==1 && p[1]==0 && p[2]==0 && p[3]==1) c++;
%o A219986 inc(a,80);
%o A219986 }
%o A219986 document.write(c+", ");
%o A219986 }
%Y A219986 Cf. A219670, A219671.
%K A219986 nonn
%O A219986 0,3
%A A219986 _Jon Perry_, Dec 02 2012
%E A219986 More terms from _Alois P. Heinz_, Dec 02 2012