(num, num_ways, divisible_by=8)
return result
Evenly splits num, num_ways so each piece is a multiple of divisible_by.
Evenly splits num, num_ways so each piece is a multiple of divisible_by.
Evenly splits num num_ways so each piece is a multiple of divisible_by .
def _split_divisible(num, num_ways, divisible_by=8):
  """Evenly splits num, num_ways so each piece is a multiple of divisible_by."""
  assert num % divisible_by == 0
  assert num / num_ways >= divisible_by
  # Note: want to round down, we adjust each split to match the total.
  base = num // num_ways // divisible_by * divisible_by
  result = []
  accumulated = 0
  for i in range(num_ways):
    r = base
    while accumulated + r < num * (i + 1) / num_ways:
      r += divisible_by
    result.append(r)
    accumulated += r
  assert accumulated == num
  return result
def _split_divisible ( num , num_ways , divisible_by = 8 ) : assert num % divisible_by == 0 assert num / num_ways >= divisible_by # Note: want to round down, we adjust each split to match the total. base = num // num_ways // divisible_by * divisible_by result = [ ] accumulated = 0 for i in range ( num_ways ) : r = base while accumulated + r < num * ( i + 1 ) / num_ways : r += divisible_by result . append ( r ) accumulated += r assert accumulated == num return result