a non-riddle

Unless I missed a point in the last riddle from the Riddler, there is very little to say about it:

Given N ocre balls, N aquamarine balls, and two urns, what is the optimal way to allocate the balls to the urns towards drawing an ocre ball with no urn being empty?

Both my reasoning and a two line exploration code led to having one urn with only one ocre ball (and no acquamarine ball) and all the other balls in the second urn.

odz<-function(n,m,t) 2*m/n+(t-2*m)/(t-n)
for (n in 1:(N-1))
  for (m in 1:(trunc(N/2)-1))

4 Responses to “a non-riddle”

  1. […] leave a comment for the author, please follow the link and comment on their blog: R – Xi’an’s Og. R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data […]

  2. ΓΔ 047 Says:

    That’s what I did for the same problem:


    data.frame(rnum = rep(1:99, 49), cnum = rep(1:49, each = 99)) %>%
    mutate(setup = paste0(“Col”, cnum)) %>%
    mutate_at(vars(setup), factor, levels = paste0(“Col”, 1:49)) %>%
    mutate(value = map2_dbl(
    cnum, rnum,
    ~ {
    ifelse(.y 50 + .x, NA, 1 / 2 * .x / .y + 1 / 2 * (50 – .x) / (100 – .y))
    )) -> my.df

    colors <- colorRampPalette(c("#3288bd", "#ffffbf", "#d53e4f"))(length(levels(my.df$setup)))

    ggplot(my.df, aes(x = rnum, y = value, group = setup, color = setup)) +
    geom_xspline(spline_shape = -0.4, size = 0.5) +
    scale_colour_manual(values = setNames(colors, levels(my.df$setup))) +

  3. […] article was first published on R – Xi'an's Og, and kindly contributed to […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: