A316296 a(n) = Sum_{k=1..n} f(k, n), where f(i, j) is the number of multiples of i greater than j and less than 2*j.
0, 1, 3, 5, 9, 10, 15, 18, 21, 24, 31, 30, 38, 41, 44, 48, 55, 56, 64, 65, 70, 75, 84, 81, 90, 95, 98, 103, 112, 109, 120, 123, 129, 134, 139, 139, 150, 155, 160, 161, 173, 170, 183, 184, 187, 198, 205, 202, 212, 217, 223, 226, 239, 236, 245, 248, 255, 262, 271, 266, 282, 285, 288
Offset: 1
Examples
For n = 7, a(7) = f(1,7) + f(2,7) + f(3,7) + f(4,7) + f(5,7) + f(6,7) + f(7,7) = 6 + 3 + 2 + 2 + 1 + 1 = 15.
Programs
-
JavaScript
function f(n,m){ var count = 0; for(var i=m+1; i<2*m; i++){ if(i%n === 0) count++; } return count; } function sf(n){ var sum = 0; for(var i=1; i<=n; i++){ sum += f(i, n); } return sum; }
-
PARI
a(n) = n + sum(m = 1, n, (floor((n<<1 - 1) / m) - ceil((n + 1) / m))) \\ David A. Corneth, Jun 29 2018
-
Python
from math import isqrt def A316296(n): return ((s:=isqrt(n))+(t:=isqrt(m:=(n<<1)-1)))*(s-t)+(sum(m//k for k in range(1,t+1))-sum(n//k for k in range(1,s+1))<<1)-n+1 # Chai Wah Wu, Oct 24 2023
Formula
a(n) = Sum_{k=1..n} Sum_{i=n+1..2n-1} (1-ceiling(i/k)+floor(i/k)). - Wesley Ivan Hurt, Feb 08 2022
Comments