Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #49 Jul 29 2023 10:26:29
%S 1,1,3,1,3,3,1,3,5,3,1,3,5,5,3,1,3,5,7,5,3,1,3,5,7,7,5,3,1,3,5,7,9,7,
%T 5,3,1,3,5,7,9,9,7,5,3,1,3,5,7,9,11,9,7,5,3,1,3,5,7,9,11,11,9,7,5,3,1,
%U 3,5,7,9,11,13,11,9,7,5,3,1,3,5,7,9,11,13,13,11,9,7,5,3,1,3,5,7,9,11,13,15,13,11,9,7,5,3,1,3,5,7,9,11,13,15,15,13,11,9,7,5,3
%N a(n) = floor(sqrt(2*n-1) + 1/2) - abs(2*(n-1) - (floor(sqrt(2*n-1) + 1/2))^2) + 1.
%C First bisection of A004738.
%C All terms are odd.
%H Chai Wah Wu, <a href="/A274773/b274773.txt">Table of n, a(n) for n = 1..10000</a>
%H Ilya Gutkovskiy, <a href="/A274773/a274773.pdf">Illustrations</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/SmarandacheSequences.html">Smarandache Sequences</a>
%e Triangle begins:
%e 1;
%e 1, 3;
%e 1, 3, 3;
%e 1, 3, 5, 3;
%e 1, 3, 5, 5, 3;
%e 1, 3, 5, 7, 5, 3;
%e 1, 3, 5, 7, 7, 5, 3;
%e 1, 3, 5, 7, 9, 7, 5, 3;
%e 1, 3, 5, 7, 9, 9, 7, 5, 3;
%e ...
%e Read like the Ulam spiral, starting with 1:
%e x 7 x 5 x 3 x 1
%e 7 x 5 x 3 x 1 x
%e x 5 x 3 x 1 x 3
%e 5 x 3 x 1 x 3 x
%e x 3 x 1 x 3 x 5
%e 3 x 1 x 3 x 5 x
%e x 1 x 3 x 5 x 7
%e 1 x 3 x 5 x 7 x
%t Table[Floor[Sqrt[2 n - 1] + 1/2] - Abs[2 (n - 1) - Floor[Sqrt[2 n - 1] + 1/2]^2] + 1, {n, 1, 120}]
%o (Python)
%o from gmpy2 import isqrt_rem
%o def A274773(n):
%o i, j = isqrt_rem(2*n-1)
%o return int(i+2 - abs(j-2*(i+1)) if 4*(i-j) + 1 <= 0 else i+1 - abs(j-1)) # _Chai Wah Wu_, Aug 15 2016
%Y Cf. A004738, A005408.
%K nonn,easy,tabl
%O 1,3
%A _Ilya Gutkovskiy_, Aug 11 2016