

A220400


Number of ways to write n as sum of at least 2 consecutive odd positive integers.


3



0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 2, 0, 0, 0, 1, 1, 0, 0, 2, 1, 0, 1, 1, 0, 0, 0, 2, 1, 0, 1, 2, 0, 0, 1, 2, 0, 0, 0, 1, 2, 0, 0, 3, 1, 0, 1, 1, 0, 0, 1, 2, 1, 0, 0, 2, 0, 0, 2, 3, 1, 0, 0, 1, 1, 0, 0, 3, 0, 0, 2, 1, 1, 0, 0, 3, 2, 0, 0, 2, 1, 0, 1, 2, 0, 0, 1, 1, 1, 0, 1, 4, 0, 0, 2, 2, 0, 0, 0, 2, 3
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,17


COMMENTS

Records occur at 0, 4, 16, 48, 96, 144, 240, 480, 720, 960, 1440, ..., (A297160).  Antti Karttunen, Dec 27 2017
Also number of ways to express n in the form k + (k + 2) + ... + (k + 2*m  2) = m * (k + m  1) where k > 0 is odd and m > 0 and m * (m + 1) < n.  David A. Corneth, Dec 27 2017


LINKS

Antti Karttunen, Table of n, a(n) for n = 0..11111


EXAMPLE

For n=16 we can write 1+3+5+7 and 7+9, thus a(16) = 2.
For n = 24, we look for sums of consecutive numbers of m terms of the form m * (k + m  1) for odd k and m * (m + 1) < 24, i.e., m < 5. We can factorize 24 as such in two positive factors as 1 * 24 = 2 * 12 = 3 * 8 = 4 * 6 giving m = 1, 2, 3 and 4 respectively. Solving for k gives k = 24, k = 11, k = 6 and k = 3 respectively. Of these values, two are odd so a(24) = 2. Superfluously, the corresponding sums are 11 + 13 = 3 + 5 + 7 + 9.  David A. Corneth, Dec 28 2017


MATHEMATICA

nn = 100; t = Table[0, {nn}]; Do[s = odd = 2*n  1; While[odd = odd + 2; s = s + odd; s <= nn, t[[s]]++], {n, nn/2}]; Join[{0}, t] (* T. D. Noe, Dec 18 2012 *)


PROG

(Scheme) (define (A220400 n) (let loop ((s 0) (begin 1) (end 1) (sum 1)) (cond ((> begin (/ n 2)) s) ((< sum n) (loop s begin (+ end 2) (+ sum end 2))) ((> sum n) (loop s (+ begin 2) end ( sum begin))) (else (loop (+ 1 s) (+ begin 2) end ( sum begin)))))) ;; Antti Karttunen, Dec 27 2017
(PARI) a(n) = if(n==0, return(0)); my(d = divisors(n)); (#d + 1) \ 2  sum(i = 2, (#d + 1) \ 2, (n / d[i]  d[i]) % 2)  1 \\ David A. Corneth, Dec 27 2017


CROSSREFS

Cf. A069283 (even numbers lead to this sequence).
Cf. A297160 (positions of records).
Sequence in context: A133703 A073265 A025438 * A285108 A030216 A159459
Adjacent sequences: A220397 A220398 A220399 * A220401 A220402 A220403


KEYWORD

nonn


AUTHOR

Carl Najafi, Dec 13 2012


EXTENSIONS

More terms from Antti Karttunen, Dec 27 2017


STATUS

approved



