|
|
A257175
|
|
The smallest m such that the m-th triangular number is greater than or equal to half the n-th triangular number.
|
|
1
|
|
|
0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 24, 25, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 36, 37, 38, 39, 39, 40, 41, 41, 42, 43, 43, 44, 45, 46, 46, 47, 48, 48, 49, 50, 51, 51, 52, 53, 53, 54, 55, 56, 56, 57
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
The a(n)-th triangular number is the smallest triangular number that is greater than or equal to half of the n-th triangular number.
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
For n=4, the 4th triangular number is 10. a(4)=3 as the 3rd triangular number is the first which is 5 or more.
|
|
MATHEMATICA
|
f[n_] := Block[{t = Accumulate[Range@ n], k, m}, {1}~Join~Rest@ Flatten@ Reap@ For[k = 1, k < n, m = 1; While[t[[m]] < t[[k]]/2, m++]; Sow[m], k++]]; f@ 80 (* Michael De Vlieger, Apr 17 2015 *)
|
|
PROG
|
(Python)
def tri(n):
... return .5*n*(n+1)
.
for n in range(1, 10001):
... k = 1
... while 2*tri(k)<tri(n):
....... k+=1
... print k
(PARI) a(n) = my(t = n*(n+1)/4, k = 0); while(k*(k+1)/2 < t, k++); k; \\ Michel Marcus, Apr 17 2015
(Magma) [Ceiling((Sqrt(2*n^2 + 2*n + 1) - 1)/2): n in [1..80]]; // Vincenzo Librandi, Apr 18 2015
(MIT/GNU Scheme) (define (A257175 n) (ceiling->exact (/ (+ -1 (sqrt (+ (* 2 n n) n n 1))) 2))) ;; After Greathouse's formula - Antti Karttunen, Apr 18 2015
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|