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!)
A104512 a(n) is the minimum number that is the first of k > 1 consecutive integers whose sum equals n, or 0 if impossible. 6

%I #19 Mar 31 2021 22:31:06

%S 0,0,1,0,2,1,3,0,2,1,5,3,6,2,1,0,8,3,9,2,1,4,11,7,3,5,2,1,14,4,15,0,3,

%T 7,2,1,18,8,4,6,20,3,21,2,1,10,23,15,4,8,6,3,26,2,1,5,7,13,29,4,30,14,

%U 3,0,2,1,33,5,9,7,35,4,36,17,3,6,2,1,39,14,5,19,41,7,4,20,12,3,44,2,1,8,13

%N a(n) is the minimum number that is the first of k > 1 consecutive integers whose sum equals n, or 0 if impossible.

%D Alfred S. Posamentier, Math Charmers, Tantalizing Tidbits for the Mind, Prometheus Books, NY, 2003, page 67.

%H Antti Karttunen, <a href="/A104512/b104512.txt">Table of n, a(n) for n = 1..16416</a>

%F a(n)=0 iff n=2^k.

%F a(n)=1 iff n is a triangular number (A000217).

%e a(18) = 3 because 3+4+5+6 = 5+6+7 = 18 but 3 < 5.

%t f[n_] := Block[{r = Ceiling[n/2]}, If[ IntegerQ[ Log[2, n]], 0, m = Range[r]; lst = Flatten[ Table[ m[[k]], {i, r}, {j, i + 1, r}, {k, i, j}], 1]; lst[[ Position[ Plus @@@ lst, n, 1, 1][[1, 1]], 1]]]]; Table[ f[n], {n, 93}] (* _Robert G. Wilson v_, Feb 25 2005 *)

%o (PARI) A104512(n) = if(!bitand(n,n-1), 0, my(b,d,u=1+sqrtint(2*n)); for(k=0,n-2,b = binomial(k+1,2); forstep(j=min(n,k+u),k+2,-1, d = binomial(j+1,2) - b; if(d==n,return(1+k),if(d<n,break)))); (0)); \\ _Antti Karttunen_, Mar 30 2021

%Y Cf. A104513, A104514, A104515, A104516.

%Y Cf. A118235.

%K nonn,look

%O 1,5

%A Alfred S. Posamentier (asp2(AT)juno.com) and _Robert G. Wilson v_, Feb 23 2005

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 September 6 06:24 EDT 2024. Contains 375703 sequences. (Running on oeis4.)