|
|
A006590
|
|
a(n) = Sum_{k=1..n} ceiling(n/k).
(Formerly M2522)
|
|
25
|
|
|
1, 3, 6, 9, 13, 16, 21, 24, 29, 33, 38, 41, 48, 51, 56, 61, 67, 70, 77, 80, 87, 92, 97, 100, 109, 113, 118, 123, 130, 133, 142, 145, 152, 157, 162, 167, 177, 180, 185, 190, 199, 202, 211, 214, 221, 228, 233, 236, 247, 251, 258, 263, 270, 273, 282, 287, 296, 301
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
Given the fact that ceiling(x) <= x+1, we can, using well known results for the harmonic series, easily derive that n*log(n) <= a(n) <= n*(1+log(n)) + n = n(log(n)+2). - Stefan Steinerberger, Apr 08 2006
|
|
REFERENCES
|
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
|
|
LINKS
|
|
|
FORMULA
|
|
|
MAPLE
|
seq(add(ceil(n/j), j = 1..n), n = 1..60); # G. C. Greubel, Nov 07 2019
|
|
MATHEMATICA
|
nxt[{n_, a_}]:={n+1, a+DivisorSigma[0, n]+1}; Transpose[NestList[nxt, {1, 1}, 60]][[2]] (* Harvey P. Dale, Aug 23 2013 *)
|
|
PROG
|
(Haskell)
a006590 n = sum $ map f [1..n] where
f x = y + 1 - 0 ^ r where (y, r) = divMod n x
(PARI) first(n)=my(v=vector(n, i, i), s); for(i=1, n-1, v[i+1]+=s+=numdiv(i)); v \\ Charles R Greathouse IV, Feb 07 2017
(PARI) a(n) = n + sum(k=1, n-1, (n-1)\k); \\ Michel Marcus, Oct 10 2021
(Magma) [&+[Ceiling(n/j): j in [1..n]] : n in [1..60]]; // G. C. Greubel, Nov 07 2019
(Sage) [sum(ceil(n/j) for j in (1..n)) for n in (1..60)] # G. C. Greubel, Nov 07 2019
(Python)
from math import isqrt
def A006590(n): return (lambda m: n+2*sum((n-1)//k for k in range(1, m+1))-m*m)(isqrt(n-1)) # Chai Wah Wu, Oct 09 2021
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,nice,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|