Divide $n$ gifts among three people so as to minimize the difference in the total cost of gifts between the most lucky and the most unlucky people


Divide $ n$ gifts of different values among three people so as to minimize the difference in the total cost of the gifts for the most lucky and the most unlucky persons.

The total value of $ n$ gifts is $ W$ . The most fair division will be to give all of them gifts of the total value $ W/3$ .

Suppose $ W_1, W_2, W_3$ are the total values of the gifts of the first, second and third person.

We want to minimize: $ max(W_1, W_2, W_3) – min(W_1, W_2, W_3)$ .

Using the knapsack problem. Assign to the first knapsack the “weight” $ W/3$ and the same for the second knapsack $ W/3$ . Use double knapsack algorithm and get the for each knapsack the gifts that maximizes the total value but obeys the $ W_{i \in {1,2}} \le W/3$ property. Then the remaining gifts give to the third person.

The question is if such kind of algorithm is correct? If so why? If no can you provide your own solution to the problem?

Is this adjustment to the Lucky feat underpowered?

I have the feeling Lucky feat in 5e is overpowered.

I have a modification that I want to propose my players with says you have to decide to use your luck point BEFORE rolling the dice. That’s the only modification so the feat will be:

You have 3 luck points. Whenever you make an attack roll, an ability check, or a saving throw, you can spend one luck point to roll an additional d20. You can choose to spend one of your luck points only before you roll the die and before the outcome is determined. You choose which of the d20 is used for the attack roll, ability check or saving throw.

You can also spend one luck point before an attack roll is made against you. Roll a d20, and then choose whether the attacker uses the attacker roll or yours. You choose the dice before the attack roll is made and, therefore, before knowing the attacker roll result.

The rest of the feat description (i.e. cancelling rules) remains unchanged.

I feel that makes the feat less powerful by turning a “I don’t really like this result” to “I really want to make sure I get this right”. That way the player needs to carefully decide what matters and what doesn’t before rolling, afterwards is just too late.

Is this modification, however, underpowered to the point that it makes the feat useless (meaning the feat will not be picked up by players since its not worth it)?

Note: I’ll accept frame challenges if you think the original lucky feat is not overpowered, although I think that may end up going to opinion based quickly.


Reasons I feel it is overpowered There are numerous discussions already on the internet about the Lucky feat. My take on it is that it allows way too many rerolls for any roll, after knowing the die roll (which means you at least have a feeling of whether you’ll fail or not).

In my view this means that the players are able to, on demand, reroll at will any critical situation they find themselves on and those usually do not happen more than 3 times per day and when they happen, it is simply not that difficult to spot them. I don’t usually put my players on such tight corners that they have more than 3 situations a day where the outcome of a single roll is of vital importance and the fact that you can decide after looking at the dice means that out of those critical situations, some of them would be naturally saved, allowing you to simply “save” the luck point. Then the next adventuring day, boom, you have your points again to start over with your safety net of, “if everything goes wrong I can count on my luck”.

Making the players decide FIRST means that luck points are precious and valuable and you really have to think first, is this worth making absolutely sure I have the best chances to succeed or is it better to save it for later? Is this a really critical situation?

With deciding after they can instead go like: oh, it seems like I’m going to fail this thing… ok, I don’t want to fail so I’m going to spend a luck point. It’s a fallback, not a carefully thought tradeoff.

Even though the players do perform dozens of rolls per adventuring day, most of them do not matter so much. Attack roll, you fail, fine,next. Attack roll, you succeed, great. But then there’s this occasional thing that really matters, “saving throw” against a fireball, that lockpick to enter the throne room, that deception check to escape from a contrieved situation, that last attack you’ve just failed with 5 HP left which you feel, if succeded may have just killed the monster… those are the ones that do change the course of the adventure. Yes, players roll a lot, but critical, potentially changing situations are far and between events that do not happen that often (at least not on my adventures).

I don’t want to quote all the internet here but Lucky is consitently considered either broken or one of the most useful feats on the game, usually being quoted as THE most useful feat for all the above reasons.

Does using the Lucky Feat to tranform disadvantage into super-advantage still work with a net?

In this question, it can be seen that using a luck point when doing something at a disadvantage essentially transforms it into super-advantage.

Does this specific strategy still works when throwing a net (which, by default, are always at a disadvantage due to their 5ft short range) ?

URL for “I’m Feeling Lucky” within specific site

I’m looking for an URL that goes directly to the first Google hit from a certain domain as in “I’m Feeling Lucky” but limited to a certain domain.

I’m using this formula, but it typically doesn’t work.

http://www.google.com/search?q=SEARCHTERM%20site:SITEURL&btnI 

Edit: It seems to work a lot of the time actually. However, there are quite a few cases in which it will not work.

URL for “I’m Feeling Lucky” within specific site

I’m looking for an URL that goes directly to the first Google hit from a certain domain as in “I’m Feeling Lucky” but limited to a certain domain.

I’m using this formula, but it typically doesn’t work.

http://www.google.com/search?q=SEARCHTERM%20site:SITEURL&btnI 

Edit: It seems to work a lot of the time actually. However, there are quite a few cases in which it will not work.

Foobar Challenge: Lovely Lucky Lambs

I’ve been able to reduce my solution to constant time. Is it possible to reduce this by any constant factor further? (Besides trivialities i.e. inserting constants, not lazy importing). Specifically, I’d like to speed up fastMinPayout if there is a way to do it without using log.

''' Lovely Lucky LAMBs      ==================      Being a henchman isn't all drudgery. Occasionally, when Commander Lambda is feeling generous,     she'll hand out Lucky LAMBs (Lambda's All-purpose Money Bucks). Henchmen can use Lucky LAMBs     to buy things like a second pair of socks, a pillow for their bunks, or even a third daily meal!      However, actually passing out LAMBs isn't easy. Each henchman squad has a strict seniority     ranking which must be respected - or else the henchmen will revolt and you'll all get demoted     back to minions again!       There are 4 key rules which you must follow in order to avoid a revolt:         1. The most junior henchman (with the least seniority) gets exactly 1 LAMB.  (There will         always be at least 1 henchman on a team.)         2. A henchman will revolt if the person who ranks immediately above them gets more than         double the number of LAMBs they do.         3. A henchman will revolt if the amount of LAMBs given to their next two subordinates         combined is more than the number of LAMBs they get.  (Note that the two most junior henchmen         won't have two subordinates, so this rule doesn't apply to them.  The 2nd most junior henchman         would require at least as many LAMBs as the most junior henchman.)         4. You can always find more henchmen to pay - the Commander has plenty of employees.         If there are enough LAMBs left over such that another henchman could be added as the         most senior while obeying the other rules, you must always add and pay that henchman.      Note that you may not be able to hand out all the LAMBs. A single LAMB cannot be subdivided.     That is, all henchmen must get a positive integer number of LAMBs.      Write a function called answer(total_lambs), where total_lambs is the integer number of     LAMBs in the handout you are trying to divide. It should return an integer which represents     the difference between the minimum and maximum number of henchmen who can share the LAMBs     (that is, being as generous as possible to those you pay and as stingy as possible, respectively)     while still obeying all of the above rules to avoid a revolt.  For instance, if you had 10 LAMBs     and were as generous as possible, you could only pay 3 henchmen (1, 2, and 4 LAMBs, in order of     ascending seniority), whereas if you were as stingy as possible, you could pay 4 henchmen (1, 1,     2, and 3 LAMBs). Therefore, answer(10) should return 4-3 = 1      To keep things interesting, Commander Lambda varies the sizes of the Lucky LAMB payouts: you can     expect total_lambs to always be between 10 and 1 billion (10 ^ 9).      ================== '''  ''' Recursive form Rules: 1) A0 = 1 2) An+1 !> 2*An 3) An-1 + An-2 !> An 4) n -> inf  Rewritten: 1) A0 = 1 2) An <= 2*An-1 3) An >= An-1 + An-2 4) n -> inf  Therefore:  A0 = 1, A-1 = 0, A-2 = 0 An-1 + An-2 <= An <= 2*An-1 '''   def maxPayout(LAMBs):     '''     Given An-1 + An-2 <= An <= 2*An-1     An is maximized when An = 2*An-1     '''     # payouts[0] and payouts[1] exist as 'dummy' payouts     payouts = [0, 0, 1]     LAMBs -= payouts[-1]      while (LAMBs >= 0):         payouts.append(2*payouts[-1])         LAMBs -= payouts[-1]      # -2 for first two 'dummy' payouts and -1 for extra payout     return len(payouts) - 2 - 1   def minPayout(LAMBs):     '''     Given An-1 + An-2 <= An <= 2*An-1     An is minimized when An = An-1 + An-2     '''     # payouts[0] and payouts[1] exist as 'dummy' payouts     payouts = [0, 0, 1]     LAMBs -= payouts[-1]      while (LAMBs >= 0):         payouts.append(payouts[-1] + payouts[-2])         LAMBs -= payouts[-1]      # -2 for first two 'dummy' payouts and -1 for extra payout     return len(payouts) - 2 - 1   def solution(total_lambs):     return minPayout(total_lambs) - maxPayout(total_lambs)   def fastMaxPayout(LAMBs):     '''     Since maxPayout follows An = 2*An-1, maxPayout follows     geometric sequence that can be reduced to exponential.      An = 2^n      Then we solve for sum(An = 2^n) <= LAMBs and the geometric     series' sum formula follows:      Sn = A0 * 1-r^n / (1-r)     Sn = 1 * 1-2^n / (1-2)     Sn = 2^n - 1      Now we finally solve (Sn = 2^n - 1) <= LAMBs      2^n <= LAMBs + 1     n <= log2(LAMBs + 1)     n = floor(log2(LAMBs + 1)) = (LAMBs + 1).bit_length() - 1     '''     return (LAMBs + 1).bit_length() - 1   def fastMinPayout(LAMBs):     '''     Since minPayout follows An = An-1 + An-2, minPayout follows     a shifted Fibonnacci sequence. Apply Binet's formula to     derive the nth Fibonnacci sequence.      An-1 = Fn = ((1+sqrt(5) / 2)^n - (1-sqrt(5) / 2)^n) / sqrt(5)      Substitute constants for variables to simplify      let a = 1+sqrt(5) / 2     let b = 1-sqrt(5) / 2     let x = An-1 * sqrt(5)      x = a^n - b^n     a^n = x + b^n     n = loga(x + b^n)ls      And since lim n->inf b^n = 0, Binet's formula approximates:      n = loga(x)      Now we finally solve (Sn = An+2 - 1) >= LAMBs      n+3 = loga(An+2 * sqrt(5)) = loga((An+2 - 1 + 1) * sqrt(5))     n = loga((LAMBs + 1) * sqrt(5)) - 3     '''     from math import log, ceil, sqrt     return int(ceil(log((LAMBs + 1 + 0.5)*sqrt(5), (1+sqrt(5)) / 2)) - 3)   def fastSolution(total_lambs):     return fastMinPayout(total_lambs) - fastMaxPayout(total_lambs)   print(solution(143), fastSolution(143)) 

Portent vs Lucky Feat — which wins?

When a divination wizard character uses their Portent ability:

Starting at 2nd level when you choose this school, glimpses of the future begin to press in on your awareness. When you finish a long rest, roll two d20s and record the numbers rolled. You can replace any attack roll, saving throw, or ability check made by you or a creature that you can see with one of these foretelling rolls. You must choose to do so before the roll, and you can replace a roll in this way only once per turn.

… to replace a roll, can a player with the Lucky Feat:

Whenever you make an attack roll. an ability check, or a saving throw, you can spend one luck point to roll an additional d20. You can choose to spend one of your luck points after you roll the die, but before the outcome is determined. You choose which of the d20s is used for the attack roll, ability check, or saving throw.

You can also spend one luck point when an attack roll is made against you. Roll a d20, and then choose whether the attack uses the attackers roll or yours.

If more than one creature spends a luck point to influence the outcome of a roll, the points cancel each other out; no additional dice are rolled.

… use the Luck Roll to replace the result? Or does the Portent trump all rolls and simply give you the final outcome?

This question spun off from discussion on this question.

Some relevant points:

Portent trumps Advantage/Disasgvantage.

Mike Mearls tends to believe that luck can triumph in some cases, but admits this is his opinion, and further seems to conflate the question with Halfling Luck.

I would suggest reading the linked discussion before formulating an answer. There’s some good thought there.