OFFSET
1,2
COMMENTS
With uniformly distributed input, the maximum number of items in a bucket is ceiling(n/B).
If B divides n then all buckets hold the same number of items, which is when n is in A006446.
LINKS
Paolo Xausa, Table of n, a(n) for n = 1..10000
Wikipedia, Bucket sort
FORMULA
a(n) = ceiling(n/floor(sqrt(n))).
EXAMPLE
For n = 10 a(10) = 4 because:
Input array: [0,1,2,3,4,5,6,7,8,9] and floor(sqrt(10)) = 3.
Resulting 3 buckets of [0, 1, 2, 3], [4, 5, 6, 7], [8, 9] and the number of items in the buckets is [4,4,2], which is maximum a(10) = 4.
MATHEMATICA
PROG
(Python)
from sympy.core.intfunc import isqrt
a = lambda n: ((n-1) // isqrt(n)) + 1
print([a(n) for n in range(1, 85)])
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Darío Clavijo, Dec 28 2024
STATUS
approved