|
|
A336336
|
|
Squared distance from start of a point moving in a square spiral.
|
|
7
|
|
|
0, 1, 2, 1, 2, 1, 2, 1, 2, 5, 4, 5, 8, 5, 4, 5, 8, 5, 4, 5, 8, 5, 4, 5, 8, 13, 10, 9, 10, 13, 18, 13, 10, 9, 10, 13, 18, 13, 10, 9, 10, 13, 18, 13, 10, 9, 10, 13, 18, 25, 20, 17, 16, 17, 20, 25, 32, 25, 20, 17, 16, 17, 20, 25, 32, 25, 20, 17, 16, 17, 20, 25, 32
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
The terms corresponding to the corner points of the spiral with a(k-1) < a(k) > a(k+1), i.e., 2, 2, 2, 5, 8, 8, 8, 13, 18, 18, 18, ... are given by the sequence A001105(1) repeated 3 times, (A001105(1)+A001105(2))/2, A001105(2) repeated 3 times, (A001105(2)+A001105(3))/2, A001105(3) repeated 3 times, ... .
|
|
LINKS
|
|
|
FORMULA
|
|
|
PROG
|
(PARI) A336336(m)={my(v=vectorsmall(m)); for(Lstart=0, 1, my(L=Lstart, d=1, n=0); for(r=1, oo, d=-d; my(k=floor(r/2)*d); for(j=1, L++, n++; if(n<=m, v[n]+=k*k)); forstep(j=k-d, -floor((r+1)/2)*d+d, -d, n++; if(n<=m, v[n]+=j*j)); if(n>m, break))); v};
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|