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.
%I A220102 #8 Dec 05 2012 12:20:34 %S A220102 1,2,4,6,8,3,5,7,9,11,13,15,17,19,21,23,25,10,12,14,16,18,20,22,24,26, %T A220102 28,30,32,34,36,38,40,42,44,46,48,27,29,31,33,35,37,39,41,43,45,47,49, %U A220102 51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,50,52,54,56 %N A220102 Permutation of natural numbers arising from applying the walk of square spiral (e.g. A214526) to the data of double square spiral (defined in A220098). %o A220102 (C) %o A220102 #include <stdio.h> %o A220102 #define SIZE 20 %o A220102 int grid[SIZE][SIZE]; %o A220102 int direction[] = {0, -1, 1, 0, 0, 1, -1, 0}; %o A220102 main() { %o A220102 int i, j, x1, y1, x2, y2, stepSize; %o A220102 int direction1pos=0, direction2pos=4, val; %o A220102 x1 = y1 = x2 = y2 = SIZE/2; %o A220102 for (val=grid[y1][x1]=1, stepSize=0; ; ++stepSize) { %o A220102 if (x1<1 || x1>=SIZE-1 || x2<1 || x2>=SIZE-1) break; %o A220102 if (y1<1 || y1>=SIZE-1 || y2<1 || y2>=SIZE-1) break; %o A220102 for (i=stepSize|1; i; ++val,--i) { %o A220102 x1 += direction[direction1pos ]; %o A220102 y1 += direction[direction1pos+1]; %o A220102 x2 += direction[direction2pos ]; %o A220102 y2 += direction[direction2pos+1]; %o A220102 grid[y1][x1] = val*2; %o A220102 grid[y2][x2] = val*2+1; %o A220102 } %o A220102 direction1pos = (direction1pos+2) & 7; %o A220102 direction2pos = (direction2pos+2) & 7; %o A220102 } %o A220102 direction1pos=0; %o A220102 x1 = y1 = SIZE/2; %o A220102 for (stepSize=2; ; ++stepSize) { %o A220102 for (i=stepSize/2; i; --i) { %o A220102 if (grid[y1][x1]==0) return; %o A220102 printf("%d, ",grid[y1][x1]); %o A220102 x1 += direction[direction1pos ]; %o A220102 y1 += direction[direction1pos+1]; %o A220102 } %o A220102 direction1pos = (direction1pos+2) & 7; %o A220102 } %o A220102 } %Y A220102 Cf. A214526, A220098, A217010, A217011, A217012, A217013, A217014, A217015. %K A220102 nonn %O A220102 1,2 %A A220102 _Alex Ratushnyak_, Dec 04 2012