OFFSET
1,2
EXAMPLE
A082233 begins:
1,2,3,4,5,6,7,8,9,10
3,4,5,6,7,8,9,10,11,12
5,6,7,8,9,10,11,12,13,14
so this sequence begins 1, 1+2, 1+2+3, 1+2+3+5, 1+2+3+5+4, etc...
MAPLE
r:=0 ;
c:=1 ;
A082233 := proc(n, k)
2*n+k ;
end proc:
A229035 := proc(n)
option remember;
global r, c ;
local d;
if n = 0 then
A082233(r, c) ;
else
d := r+c ;
if type(d, 'odd') then
c := c+1 ;
r := r-1 ;
if r < 0 then
r :=0 ;
end if;
else
c := c-1 ;
r := r+1 ;
if c < 1 then
c :=1 ;
end if;
end if;
procname(n-1)+A082233(r, c) ;
end if;
end proc: # R. J. Mathar, Sep 21 2013
PROG
(JavaScript)
a=new Array();
for (i=0; i<10; i++) {
a[i]=new Array();
for (j=0; j<10; j++) a[i][j]=1+2*i+j;
}
for (i=0; i<10; i++) document.write(a[i]+'<br>');
document.write('<br>');
xp=0; yp=0; d=0; s=1;
document.write(s+", ");
for (i=0; i<4; i++) {
if (d==0) {xp++; d=1; s+=a[yp][xp]; document.write(s+", "); }
if (d==1) {while (xp>0) {xp--; yp++; s+=a[yp][xp]; document.write(s+", "); }; d=2; }
if (d==2) {yp++; d=3; s+=a[yp][xp]; document.write(s+", "); }
if (d==3) {while (yp>0) {xp++; yp--; s+=a[yp][xp]; document.write(s+", "); }; d=0; }
}
CROSSREFS
KEYWORD
nonn
AUTHOR
Jon Perry, Sep 11 2013
STATUS
approved