login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = -1 + number of odd divisors of n.
18

%I #125 Dec 01 2023 06:14:03

%S 0,0,0,1,0,1,1,1,0,2,1,1,1,1,1,3,0,1,2,1,1,3,1,1,1,2,1,3,1,1,3,1,0,3,

%T 1,3,2,1,1,3,1,1,3,1,1,5,1,1,1,2,2,3,1,1,3,3,1,3,1,1,3,1,1,5,0,3,3,1,

%U 1,3,3,1,2,1,1,5,1,3,3,1,1,4,1,1,3,3,1,3,1,1,5,3,1,3,1,3,1,1,2,5,2

%N a(n) = -1 + number of odd divisors of n.

%C Number of nontrivial ways to write n as sum of at least 2 consecutive integers. That is, we are not counting the trivial solution n=n. E.g., a(9)=2 because 9 = 4 + 5 and 9 = 2 + 3 + 4. a(8)=0 because there are no integers m and k such that m + (m+1) + ... + (m+k-1) = 8 apart from k=1, m=8. - _Alfred Heiligenbrunner_, Jun 07 2004

%C Also number of sums of sequences of consecutive positive integers excluding sequences of length 1 (e.g., 9 = 2+3+4 or 4+5 so a(9)=2). (Useful for cribbage players.) - Michael Gilleland, Dec 29 2002

%C Let M be any positive integer. Then a(n) = number of proper divisors of M^n + 1 of the form M^k + 1.

%C This sequence gives the distinct differences of triangular numbers Ti giving n : n = Ti - Tj; none if n = 2^k. If factor a = n or a > (n/a - 1)/2 : i = n/a + (a - 1)/2; j = n/a - (a+1)/2. Else : i = n/2a + (2a - 1)/2; j = n/2a - (2a - 1)/2. Examples: 7 is prime; 7 = T4 - T2 = (1 + 2 + 3 + 4) - (1 + 2) (a = 7; n/a = 1). The odd factors of 35 are 35, 7 and 5; 35 = T18 - T16 (a = 35) = T8 - T1 (a = 7) = T5 - T7 (a = 5). 144 = T20 - T11 (a = 9) = T49 - T46 (a = 3). - M. Dauchez (mdzzdm(AT)yahoo.fr), Oct 31 2005

%C Also number of partitions of n into the form 1 + 2 + ...( k - 1) + k + k + ... + k for some k >= 2. Example: a(9) = 2 because we have [2, 2, 2, 2, 1] and [3, 3, 2, 1]. - _Emeric Deutsch_, Mar 04 2006

%C a(n) is the number of nontrivial runsum representations of n, and is also known as the politeness of n. - _Ant King_, Nov 20 2010

%C Also number of nonpowers of 2 dividing n, divided by the number of powers of 2 dividing n, n > 0. - _Omar E. Pol_, Aug 24 2019

%C a(n) only depends on the prime signature of A000265(n). - _David A. Corneth_, May 30 2020, corrected by _Charles R Greathouse IV_, Oct 31 2021

%D Ronald L. Graham, Donald E. Knuth and Oren Patashnik, Concrete Mathematics, 2nd ed., Addison-Wesley, 1994, see exercise 2.30 on p. 65.

%H Reinhard Zumkeller, <a href="/A069283/b069283.txt">Table of n, a(n) for n = 0..10000</a>

%H Tom M. Apostol, <a href="http://www.jstor.org/stable/3620570">Sums of Consecutive Positive Integers</a>, The Mathematical Gazette, Vol. 87, No. 508, (March 2003), pp. 98-101.

%H Alfred Heiligenbrunner, <a href="http://ah9.at/ahsummen.htm">Sum of adjacent numbers</a> (in German).

%H Henri Picciotto, <a href="http://www.mathedpage.org/teachers/staircases.pdf">Staircases</a>.

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Polite_number">Polite Number</a>.

%F a(n) = 0 if and only if n = 2^k.

%F a(n) = A001227(n)-1.

%F a(n) = 1 if and only if n = 2^k * p where k >= 0 and p is an odd prime. - _Ant King_, Nov 20 2010

%F G.f.: sum(k>=2, x^(k(k + 1)/2)/(1 - x^k) ). - _Emeric Deutsch_, Mar 04 2006

%F If n = 2^k p1^b1 p2^b2 ... pr^br, then a(n) = (1 + b1)(1 + b2) ... (1 + br) - 1. - _Ant King_, Nov 20 2010

%F Dirichlet g.f.: (zeta(s)*(1-1/2^s) - 1)*zeta(s). - _Geoffrey Critzer_, Feb 15 2015

%F a(n) = (A000005(n) - A001511(n))/A001511(n) = A326987(n)/A001511(n), with n > 0 in both formulas. - _Omar E. Pol_, Aug 24 2019

%F G.f.: Sum_{k>=1} x^(3*k) / (1 - x^(2*k)). - _Ilya Gutkovskiy_, May 30 2020

%F From _David A. Corneth_, May 30 2020: (Start)

%F a(2*n) = a(n).

%F a(n) = A001227(A000265(n)) - 1. (End)

%F Sum_{k=1..n} a(k) ~ n*log(n)/2 + (gamma + log(2)/2 - 3/2)*n, where gamma is Euler's constant (A001620). - _Amiram Eldar_, Dec 01 2023

%e a(14) = 1 because the divisors of 14 are 1, 2, 7, 14, and of these, two are odd, 1 and 7, and -1 + 2 = 1.

%e a(15) = 3 because the divisors of 15 are 1, 3, 5, 15, and of these, all four are odd, and -1 + 4 = 3.

%e a(16) = 0 because 16 has only one odd divisor, and -1 + 1 = 0.

%e Using Ant King's formula: a(90) = 5 as 90 = 2^1 * 3^2 * 5^1, so a(90) = (1 + 2) * (1 + 1) - 1 = 5. - _Giovanni Ciriani_, Jan 12 2013

%e x^3 + x^5 + x^6 + x^7 + 2*x^9 + x^10 + x^11 + x^12 + x^13 + x^14 + ...

%e a(120) = 3 as the odd divisors of 120 are the odd divisors of 15 as 120 = 15*2^3. 15 has 4 odd divisors so that gives a(120) = 4 - 1 = 3. - _David A. Corneth_, May 30 2020

%p g:=sum(x^(k*(k+1)/2)/(1-x^k),k=2..20): gser:=series(g,x=0,115): seq(coeff(gser,x,n),n=0..100); # _Emeric Deutsch_, Mar 04 2006

%p A069283 := proc(n)

%p A001227(n)-1 ;

%p end proc: # _R. J. Mathar_, Jun 18 2015

%t g[n_] := Module[{dL = Divisors[2n], dP}, dP = Transpose[{dL, 2n/dL}]; Select[dP, ((1 < #[[1]] < #[[2]]) && (Mod[ #[[1]] - #[[2]], 2] == 1)) &] ]; Table[Length[g[n]], {n, 1, 100}]

%t Table[Length[Select[Divisors[k], OddQ[#] &]] - 1, {k, 100}] (* _Ant King_, Nov 20 2010 *)

%t Join[{0}, Times @@@ (#[[All, 2]] & /@ Replace[FactorInteger[Range[2, 50]], {2, a_} -> {2, 0}, Infinity] + 1) - 1] (* _Horst H. Manninger_, Oct 30 2021 *)

%o (Haskell)

%o a069283 0 = 0

%o a069283 n = length $ tail $ a182469_row n

%o -- _Reinhard Zumkeller_, May 01 2012

%o (PARI) {a(n) = if( n<1, 0, sumdiv( n, d, d%2) - 1)} /* _Michael Somos_, Aug 07 2013 */

%o (PARI) a(n) = numdiv(n >> valuation(n, 2)) - 1 \\ _David A. Corneth_, May 30 2020

%o (Magma) [0] cat [-1 + #[d:d in Divisors(n)| IsOdd(d)]:n in [1..100]]; // _Marius A. Burtea_, Aug 24 2019

%o (Python)

%o from sympy import divisor_count

%o def A069283(n): return divisor_count(n>>(~n&n-1).bit_length())-1 if n else 0 # _Chai Wah Wu_, Jul 16 2022

%Y Cf. A000265, A001227, A001620, A062397, A057934, A138591, A182469.

%Y Cf. A095808 (sums of ascending and descending consecutive integers).

%K nonn,easy

%O 0,10

%A _Reinhard Zumkeller_, Mar 13 2002

%E Edited by _Vladeta Jovovic_, Mar 25 2002