A069283 a(n) = -1 + number of odd divisors of n.
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, 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, 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
Offset: 0
Examples
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. a(15) = 3 because the divisors of 15 are 1, 3, 5, 15, and of these, all four are odd, and -1 + 4 = 3. a(16) = 0 because 16 has only one odd divisor, and -1 + 1 = 0. 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 x^3 + x^5 + x^6 + x^7 + 2*x^9 + x^10 + x^11 + x^12 + x^13 + x^14 + ... 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
References
- Ronald L. Graham, Donald E. Knuth and Oren Patashnik, Concrete Mathematics, 2nd ed., Addison-Wesley, 1994, see exercise 2.30 on p. 65.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
- Tom M. Apostol, Sums of Consecutive Positive Integers, The Mathematical Gazette, Vol. 87, No. 508, (March 2003), pp. 98-101.
- Alfred Heiligenbrunner, Sum of adjacent numbers (in German).
- Henri Picciotto, Staircases.
- Wikipedia, Polite Number.
Crossrefs
Programs
-
Haskell
a069283 0 = 0 a069283 n = length $ tail $ a182469_row n -- Reinhard Zumkeller, May 01 2012
-
Magma
[0] cat [-1 + #[d:d in Divisors(n)| IsOdd(d)]:n in [1..100]]; // Marius A. Burtea, Aug 24 2019
-
Maple
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 A069283 := proc(n) A001227(n)-1 ; end proc: # R. J. Mathar, Jun 18 2015
-
Mathematica
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}] Table[Length[Select[Divisors[k], OddQ[#] &]] - 1, {k, 100}] (* Ant King, Nov 20 2010 *) Join[{0}, Times @@@ (#[[All, 2]] & /@ Replace[FactorInteger[Range[2, 50]], {2, a_} -> {2, 0}, Infinity] + 1) - 1] (* Horst H. Manninger, Oct 30 2021 *)
-
PARI
{a(n) = if( n<1, 0, sumdiv( n, d, d%2) - 1)} /* Michael Somos, Aug 07 2013 */
-
PARI
a(n) = numdiv(n >> valuation(n, 2)) - 1 \\ David A. Corneth, May 30 2020
-
Python
from sympy import divisor_count def A069283(n): return divisor_count(n>>(~n&n-1).bit_length())-1 if n else 0 # Chai Wah Wu, Jul 16 2022
Formula
a(n) = 0 if and only if n = 2^k.
a(n) = A001227(n)-1.
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
G.f.: sum(k>=2, x^(k(k + 1)/2)/(1 - x^k) ). - Emeric Deutsch, Mar 04 2006
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
Dirichlet g.f.: (zeta(s)*(1-1/2^s) - 1)*zeta(s). - Geoffrey Critzer, Feb 15 2015
a(n) = (A000005(n) - A001511(n))/A001511(n) = A326987(n)/A001511(n), with n > 0 in both formulas. - Omar E. Pol, Aug 24 2019
G.f.: Sum_{k>=1} x^(3*k) / (1 - x^(2*k)). - Ilya Gutkovskiy, May 30 2020
From David A. Corneth, May 30 2020: (Start)
a(2*n) = a(n).
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
Extensions
Edited by Vladeta Jovovic, Mar 25 2002
Comments