

A233074


Numbers that are exactly between the nearest square and the nearest triangular number.


4



2, 5, 23, 32, 47, 52, 65, 86, 140, 161, 170, 193, 203, 228, 266, 312, 356, 389, 403, 438, 453, 490, 545, 610, 671, 716, 735, 782, 802, 851, 1007, 1085, 1142, 1166, 1250, 1311, 1503, 1598, 1667, 1696, 1767, 1870, 2098, 2177, 2210, 2291, 2325, 2408, 2528, 2792, 2883
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

Numbers n such that n = (s+t)/2, where s is the nearest to n square, t is the triangular number nearest to n, and s != t. If there are two nearest squares, either of them is acceptable. Same for two nearest triangular numbers.
The sequence of roots of nearest squares begins: 1, 2, 5, 6, 7, 7, 8, 9, 12, 13, 13, 14, 14, 15, 16, 18, 19, 20, 20, 21, 21, ...
The sequence of roots of nearest triangular numbers begins: 2, 3, 6, 7, 9, 10, 11, 13, 16, 17, 18, 19, 20, 21, 23, 24, 26, 27, 28, 29, ...
The sequence of nt (equals sn) begins: 1, 1, 2, 4, 2, 3, 1, 5, 4, 8, 1, 3, 7, 3, 10, 12, 5, 11, 3, 3, 12, 6, ...


LINKS

Table of n, a(n) for n=1..51.


EXAMPLE

5 is in the sequence because 6 and 4 are the nearest to 5 triangular number and square, and 5 = (6+4)/2.
23 is in the sequence because 21 and 25 are the nearest to 23 triangular number and square, and 23 = (21+25)/2.


PROG

(Java)
import java.math.*;
public class A233074 {
public static void main (String[] args) {
for (long n = 1; ; n++) { // ok for small n
long r2 = (long)Math.sqrt(n), b2 = r2*r2, a2 = (r2+1)*(r2+1);
long t = (long)Math.sqrt(2*n), b3 = t*(t+1)/2, a3 = b3 + t + 1;
if (b3 > n) {
a3 = b3;
b3 = t*(t1)/2;
}
if ((b2+a3 == n*2 && n  b2 <= a2  n && a3  n <= n  b3) 
(b3+a2 == n*2 && n  b3 <= a3  n && a2  n <= n  b2))
System.out.printf("%d, ", n);
}
}
}


CROSSREFS

Cf. A000217, A000290, A233075.
Sequence in context: A038919 A141181 A191030 * A100031 A215278 A126975
Adjacent sequences: A233071 A233072 A233073 * A233075 A233076 A233077


KEYWORD

nonn,easy


AUTHOR

Alex Ratushnyak, Dec 03 2013


EXTENSIONS

Corrected by Alex Ratushnyak, Jun 08 2014


STATUS

approved



