login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

Matthew Scroggs, Table of n, a(n) for n = 0..10000

FORMULA

a(n) = ceiling((sqrt(2n^2 + 2n + 1) - 1)/2). - Charles R Greathouse IV, Apr 17 2015

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

Cf. A000217.

Sequence in context: A057561 A064726 A274616 * A210357 A057359 A076538

Adjacent sequences:  A257172 A257173 A257174 * A257176 A257177 A257178

KEYWORD

nonn,easy

AUTHOR

Matthew Scroggs, Apr 17 2015

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 3 13:49 EDT 2020. Contains 336198 sequences. (Running on oeis4.)