login
The OEIS is supported by the many generous donors to the OEIS 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

%I #41 Sep 08 2022 08:46:12

%S 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,

%T 19,20,21,22,22,23,24,24,25,26,27,27,28,29,29,30,31,31,32,33,34,34,35,

%U 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

%N The smallest m such that the m-th triangular number is greater than or equal to half the n-th triangular number.

%C 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.

%H Matthew Scroggs, <a href="/A257175/b257175.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) = ceiling((sqrt(2n^2 + 2n + 1) - 1)/2). - _Charles R Greathouse IV_, Apr 17 2015

%e 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.

%t 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 *)

%o (Python)

%o def tri(n):

%o ... return .5*n*(n+1)

%o .

%o for n in range(1,10001):

%o ... k = 1

%o ... while 2*tri(k)<tri(n):

%o ....... k+=1

%o ... print k

%o (PARI) a(n) = my(t = n*(n+1)/4, k = 0); while(k*(k+1)/2 < t, k++); k; \\ _Michel Marcus_, Apr 17 2015

%o (Magma) [Ceiling((Sqrt(2*n^2 + 2*n + 1) - 1)/2): n in [1..80]]; // _Vincenzo Librandi_, Apr 18 2015

%o (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

%Y Cf. A000217.

%K nonn,easy

%O 0,3

%A _Matthew Scroggs_, Apr 17 2015

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 19:49 EDT 2024. Contains 371963 sequences. (Running on oeis4.)