login
A276574
The infinite trunk of least squares beanstalk with reversed subsections.
7
0, 3, 8, 6, 15, 11, 24, 21, 18, 16, 35, 32, 30, 27, 48, 45, 43, 40, 38, 63, 59, 56, 53, 51, 80, 78, 75, 72, 70, 67, 64, 99, 96, 93, 90, 88, 85, 83, 120, 117, 115, 112, 108, 105, 102, 143, 139, 136, 134, 131, 128, 126, 123, 168, 165, 162, 160, 158, 155, 152, 149, 147, 144, 195, 192, 189, 186, 183, 179, 176, 173, 171
OFFSET
0,2
LINKS
FORMULA
a(0) = 0; a(1) = 3; for n > 1, let k = A255131(a(n-1)). If k+1 is not a square, then a(n) = k, otherwise a(n) = A000290(2+A000196(k+1)) - 1.
EXAMPLE
This can be viewed as an irregular table, where after 0, each row has A260734(n) = 1, 2, 2, 4, 4, 5, 5, 7, ... terms:
0;
3;
8, 6;
15, 11;
24, 21, 18, 16;
35, 32, 30, 27;
48, 45, 43, 40, 38;
63, 59, 56, 53, 51;
80, 78, 75, 72, 70, 67, 64;
99, 96, 93, 90, 88, 85, 83;
120, 117, 115, 112, 108, 105, 102;
...
Each row begins with (n^2)-1 (see A005563), and each successive term is obtained by subtracting A002828(k) from the previous term k, until ((n-1)^2)-1 would be encountered, which is not listed second time (as it already occurs as the first term of the previous row), but instead, the current row is finished and the next row is started with the term ((n+1)^2)-1.
PROG
(Scheme)
(definec (A276574 n) (cond ((zero? n) n) ((= 1 n) 3) (else (let ((maybe_next (A255131 (A276574 (- n 1))))) (if (zero? (A010052 (+ 1 maybe_next))) maybe_next (+ -1 (A000290 (+ 2 (A000196 (+ 1 maybe_next))))))))))
CROSSREFS
Cf. A005563 (left edge), A277023 (right edge).
Used to construct A276573.
Cf. A277015 (tells which rows end with squares, listed in A277016).
Sequence in context: A289485 A304299 A221951 * A276584 A098737 A164654
KEYWORD
nonn,tabf
AUTHOR
Antti Karttunen, Sep 07 2016
EXTENSIONS
Example section added and the formula rewritten to a simpler form (which is now correct) - Antti Karttunen, Oct 16 2016
STATUS
approved