login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A265359
Spiralwise distance to the nearest inner neighbor in Ulam-style square-spirals using zero-based indexing: a(0) = 0, for n >= 1, a(n) = n - A265409(n).
3
0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 11, 12, 13, 13, 13, 14, 15, 15, 15, 15, 16, 17, 17, 17, 17, 18, 19, 19, 19, 19, 19, 20, 21, 21, 21, 21, 21, 22, 23, 23, 23, 23, 23, 23, 24, 25, 25, 25, 25, 25, 25, 26, 27, 27, 27, 27, 27, 27, 27, 28, 29, 29, 29, 29, 29, 29, 29, 30, 31, 31, 31, 31, 31, 31, 31, 31, 32
OFFSET
0,3
LINKS
FORMULA
a(0) = 0, for n >= 1, a(n) = n - A265409(n).
If n <= 7, then a(n) = n, otherwise a(n) = a(n-1) + A240025(n) + A240025(n-1).
PROG
(Scheme, two variants)
(define (A265359 n) (if (zero? n) n (- n (A265409 n))))
(definec (A265359 n) (cond ((<= n 7) n) (else (+ (A265359 (- n 1)) (A240025 n) (A240025 (- n 1))))))
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Dec 16 2015
STATUS
approved