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!)
A265410 a(n) = one-based index to the nearest horizontally or vertically adjacent inner neighbor in square-grid spirals, and to the nearest diagonally adjacent inner neighbor when n is one of the corner cases A033638. 6

%I #29 Dec 13 2015 07:55:30

%S 0,1,1,1,1,1,1,1,2,2,2,3,3,3,4,5,5,5,6,7,7,7,8,9,10,10,10,11,12,13,13,

%T 13,14,15,16,17,17,17,18,19,20,21,21,21,22,23,24,25,26,26,26,27,28,29,

%U 30,31,31,31,32,33,34,35,36,37,37,37,38,39,40,41,42,43,43,43,44,45,46,47,48,49,50,50,50,51,52,53,54,55,56,57,57,57,58,59,60,61,62,63,64,65,65

%N a(n) = one-based index to the nearest horizontally or vertically adjacent inner neighbor in square-grid spirals, and to the nearest diagonally adjacent inner neighbor when n is one of the corner cases A033638.

%C By convention: a(1) = 0 because as 1 is a starting point of such spirals, it has no "inner neighbors" for itself.

%C Each n occurs A265411(n) times.

%H Antti Karttunen, <a href="/A265410/b265410.txt">Table of n, a(n) for n = 1..10001</a>

%H Antti Karttunen, <a href="/A260643/a260643.txt">R6RS-Scheme program for computing this sequence</a>

%F a(1) = 0; for 1 < n < 8, a(n) = 1 and for n >= 8: if either A240025(n-1) or A240025(n-2) is not zero [when n or n-1 is in A033638], then a(n) = a(n-1), otherwise, a(n) = 1 + a(n-1).

%F a(1) = 0; for 1 < n < 8, a(n) = 1 and for n >= 8: a(n) = a(n-1) + (1-A240025(n-1))*(1-A240025(n-2)). [The same formula in a more compact form.]

%F Other identities. For all n >= 0:

%F a(A265413(n)) = n. [Sequence is the least monotonic left inverse of A265413.]

%F a(A265412(n)) = n. [Also inverse of A265412.]

%e We arrange natural numbers as a counterclockwise spiral into the square grid in the following manner (here A stands for 10, B for 11 and C for 12). The first square corresponds with n, and the second square with the value of a(n):

%e 55433

%e 543C 51113C

%e 612B 61012B

%e 789A 71122A

%e 7789AA

%e -

%e For each n > 1, we look for the nearest horizontally or vertically adjacent neighbor of n towards the center that is not n-1, which will then be value of a(n) [e.g., it is 1 for 4, 6 and 8, while it is 2 for 9 and 11 and 3 for 12] unless n is in the corner (one of the terms of A033638), in which case the value is the nearest diagonally adjacent neighbor towards the center.

%o (Scheme, with memoizing-macro definec)

%o (definec (A265410 n) (cond ((= 1 n) 0) ((<= n 7) 1) ((or (= 1 (A240025 (- n 1))) (= 1 (A240025 (- n 2)))) (A265410 (- n 1))) (else (+ 1 (A265410 (- n 1))))))

%Y One more than A265409(n-1).

%Y Cf. A000267, A033638, A240025.

%Y Cf. A265400 (a variant).

%Y Cf. A265411, A265412, A265413 (positions of records, i.e., where value increases).

%K nonn

%O 1,9

%A _Antti Karttunen_, Dec 09 2015

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 12:33 EDT 2024. Contains 371969 sequences. (Running on oeis4.)