A161886 Number of nonzero elements in the n X n Redheffer matrix.
1, 4, 7, 11, 14, 19, 22, 27, 31, 36, 39, 46, 49, 54, 59, 65, 68, 75, 78, 85, 90, 95, 98, 107, 111, 116, 121, 128, 131, 140, 143, 150, 155, 160, 165, 175, 178, 183, 188, 197, 200, 209, 212, 219, 226, 231, 234, 245, 249, 256, 261, 268, 271, 280, 285, 294, 299, 304
Offset: 1
Keywords
Examples
The 4x4 Redheffer matrix: 1,1,1,1 1,1,0,0 1,0,1,0 1,1,0,1 contains 11 nonzero elements.
Programs
-
Mathematica
A161886[n_] := Plus @@ Table[DivisorSigma[0, i], {i, 1, n}] + n - 1 (* Enrique Pérez Herrero, Sep 25 2009 *) A161886[n_] := Total[Table[ Boole[Divisible[i, j] || (i == 1)], {i, 1, n}, {j, 1, n}], Infinity] (* Enrique Pérez Herrero, Sep 25 2009 *) A161889[n_] := Plus @@ Plus @@ Table[Boole[Divisible[i, j] || (i == 1)], {i, 1, n}, {j, 1, n}] (* Enrique Pérez Herrero, Sep 28 2009 *) A161889[n_] := Sum[Ceiling[n/i], {i, 1, n}] + DivisorSigma[0, n] - 1 (* Enrique Pérez Herrero, Sep 28 2009 *)
-
Python
from math import isqrt def A161886(n): return (lambda m: 2*sum(n//k for k in range(1, m+1))+n-1-m*m)(isqrt(n)) # Chai Wah Wu, Oct 09 2021
Formula
a(n) = A006218(n)+n-1. [Enrique Pérez Herrero, Sep 25 2009]
Extensions
Edited by N. J. A. Sloane, Jun 26 2009