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!)
A304587 A linear mapping a(n) = x + d*n of pairs of integers (x,d), where the pairs are enumerated by a number spiral along antidiagonals. 5
0, 1, 2, -1, -4, 2, 7, 14, 7, -2, -11, -22, -11, 3, 16, 31, 48, 33, 16, -3, -22, -43, -66, -45, -22, 4, 29, 56, 85, 116, 89, 60, 29, -4, -37, -72, -109, -148, -113, -76, -37, 5, 46, 89, 134, 181, 230, 187, 142, 95, 46, -5, -56, -109, -164, -221, -280, -227, -172, -115, -56, 6, 67 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
The sequence is an alternative solution to the riddle described in the comments of A304584 without the restriction of x and d to nonnegative numbers.
LINKS
EXAMPLE
d:
3 | 16 28
| / \ \
2 | 17 7 15 27
| / / \ \ \
1 | 18 8 2 6 14 26
| / / / \ \ \ \
0 | 19 9 3 0---1 5 13 25
| \ \ \ --> --> -->
-1 | 20 10 4 12 24
| \ \ / /
-2 | 21 11 23
| \ /
-3 | 22
__________________________________
x: -3 -2 -1 0 1 2 3 4
.
a(10) = -1 + 10*(-1) = -11 because the 10th position in the spiral corresponds to x = -1 and d = -1,
a(15) = 1 + 15*2 = 31 because the 15th position in the spiral corresponds to x = 1 and d = 2,
a(25) = 4 + 25*0 = 4 because the 25th position in the spiral corresponds to x = 4 and d = 0.
MAPLE
n2left := proc(n)local w, k; return floor(sqrt((n-1)/2)); end:pos2pH:=proc(n)local k, q, Q, e, E, sp; k:=n2left(n); q:=2*k^2+1; Q:=2*(k+1)^2+1; e:=n-q; E:=Q-n; if n<2 then return[n, 0]; fi; if e<=k then return[-k+e, -e]; elif e<2*k then return[-k+e, -2*k+e]; elif E<=k+1 then return[-(k+1)+E, E]; else return[E-(k+1), 2*(k+1)-E]; fi; end:WhereFlea:=proc(n) local x, d, pair; pair:=pos2pH(n); x:=pair[1]; d:=pair[2]; return x+d*n; end: seq(WhereFlea(n), n=0..62); # Rainer Rosenthal, May 28 2018
PROG
(Sage)
def a(n):
if n<2: return n
k = isqrt((n-1)/2)
e = n-k*(2*k+1)-1
x = e if e<k else k*(2*k+3)-n+2
d = abs(x)-k if e<k else k+1-abs(x)
return x + d*n
print([a(n) for n in range(63)]) # Peter Luschny, May 29 2018
CROSSREFS
Cf. A001844 (where the spiral jumps to next ring), A304584, A304585, A304586.
Sequence in context: A325345 A079966 A101707 * A364952 A113418 A117000
KEYWORD
sign,look
AUTHOR
Hugo Pfoertner, May 16 2018
EXTENSIONS
a(1) corrected by Rainer Rosenthal, May 28 2018
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 April 25 01:35 EDT 2024. Contains 371964 sequences. (Running on oeis4.)