I can verify solutions to my problem in polynomial time, how would a non-deterministic algorithm arrive to a solution if it always takes $2^n$ bits?

Decision Problem: Given integers as inputs for $ K$ and $ M$ . Is the sum of $ 2^k$ + $ M$ a $ prime$ ?


m = int(input('Enter integer for M: ')) sum_of_2**K+M=int(input('enter the sum of 2^k+m: '))  if AKS.sum_of_2**K+M == True:    # Powers of 2 can be verified in O(N) time   # make sure there is all 0-bits after the 1st ONE-bit      # Use difference to verify problem    if sum_of_2**K+M - (M) is a power_of_2:     OUTPUT Solution Verified 

The powers of 2 have approximately $ 2^n$ digits. Consider $ 2^k$ where $ K$ = 100000. Compare the amount of digits in $ K$ to the amount of digits in it’s solution! Also take note that the powers of 2 have $ 2^n$ bits as its 0-bit Unary essentially for the exponent $ n$ .


How would a non-deterministic machine solve this problem in polynomial time?

A player rolls four 20-sided dice, takes the lowest value, ignores the rest. What is the probability of this value at least 7?

I’m designing a tabletop game, and I need to figure out how to calculate a few probabilities:

  1. Roll 3 20-sided dice, take the highest value. What is the probability of it being 7 or higher? 15 or higher?
    1. Roll 4 20-sided dice, take the highest value. What is the probability of it being 7 or higher? 15 or higher?
    1. Roll 3 20-sided dice, take the lowest value. What is the probability of it being 7 or higher? 15 or higher?
    1. Roll 4 20-sided dice, take the lowest value. What is the probability of it being 7 or higher? 15 or higher?

How can I do this? Could you explain to me how this works, or even better – give me a simple formula?

Solving symoblic system of non-linear equations takes too long

I am trying to solve a set of system of symbolic non-linear equations:

g1 = ptz + pz + 2 pty q0 q1 - 2 ptz q1^2 + 2 px q0 q2 - 2 pz q2^2 -     2 px q1 q3 - 2 pty q2 q3 - 2 ptz q3^2 - 2 pz q3^2 ; g2 = 2 (ptx q0 q1 + px q0 q1 + ptz q1 q2 - pz q1 q2 + ptz q0 q3 +       pz q0 q3 - ptx q2 q3 + px q2 q3); g3 = ptx + px - 2 ptx q1^2 - 2 px q1^2 - 2 pz q0 q2 - 2 pty q1 q2 -     2 px q2^2 - 2 pty q0 q3 - 2 pz q1 q3 - 2 ptx q3^2 ; g4 = -2 pty q0 q2 - 2 py q0 q2 + 2 ptz q1 q2 - 2 pz q1 q2 -     2 ptz q0 q3 - 2 pz q0 q3 - 2 pty q1 q3 + 2 py q1 q3 ; g5 = ptz + pz - 2 py q0 q1 - 2 pz q1^2 - 2 ptx q0 q2 - 2 ptz q2^2 -     2 ptx q1 q3 - 2 py q2 q3 - 2 ptz q3^2 - 2 pz q3^2 ; g6 = -pty - py - 2 pz q0 q1 + 2 py q1^2 + 2 ptx q1 q2 + 2 pty q2^2 +     2 py q2^2 - 2 ptx q0 q3 + 2 pz q2 q3 + 2 pty q3^2 ; g7 = q0^2 + q1^2 + q2^2 + q3^2;  NSolve[{g1 == 0, g2 == 0, g3 == 0, g4 == 0, g5 == 0, g6 == 0,    g7 == 1}, {q0, q1, q2, q3}, Reals] 

Here all variables except q0, q1, q2 and q3 are considered fixed. The variables represent a unit quaternion. Testing for corner cases (by setting single element of quaternion to 0) reveals that these set of equations don’t have a solution, which is what I intend to prove. But the code takes too long to run. Any suggestions would be appreciated.

I could treat the elements of quaternion and the permutations of the elements as separate variable and solve the system as Linear Equations, which I did for the corner cases. But here I don’t have enough constraints (10 unknowns with 7 constraints) and hence can’t employ that method.

RAW, when using the Abjuration Wizard’s Projected Ward, who takes “any remaining damage”?

The Abjuration Wizard’s 2nd level ability Arcane Ward reads:

Starting at 2nd level, you can weave magic around yourself for protection. When you cast an abjuration spell of 1st level or higher, you can simultaneously use a strand of the spell’s magic to create a magical ward on yourself that lasts until you finish a long rest.

In the context of this ability, the wizard is the "warded creature", obviously.

The 6th level ability, Projected Ward, reads:

Starting at 6th level, when a creature that you can see within 30 feet of you takes damage, you can use your reaction to cause your Arcane Ward to absorb that damage. If this damage reduces the ward to 0 hit points, the warded creature takes any remaining damage.

To use Projected Ward, you must already have your Arcane Ward active, thus before using your reaction, you are definitely "the warded creature". In the description for Projected Ward, it says you are using "your ward", as in the ward that is warding you, to absorb the damage.

In the context of this ability who is the "warded creature", the wizard or the creature who took the damage that triggered the reaction?

The RAI seems obvious here, but I would prefer a RAW focused ruling.

How do I deal with a player wanting to do an activity that takes weeks when the party doesn’t want to?

I’m currently running a campaign with 5 players at level 3, one of which is a Wizard Dragonborn who’s entire character is devoted to becoming a real dragon by the end of the campaign through some kind of magic or holy gift or something.

As part of this, the player has decided that he absolutely MUST have a Pseudodragon and has decided that next session, as the players have finally returned to town after leaving at level 1, he is going to spend a few days resting before setting off alone to explore the forests of the nearby area to find a Pseudodragon.

I explained to him that on foot, sweeping the whole forest systematically (in a frontier part of the world where the majority of the land is forested) will take literally weeks for his character to do, as he has no spells that can assist him except find familiar (which he could use to sweep the air with a hawk).

When I explained that, this would involve him as a player turning up to the session (online) and contributing essentially nothing for extended periods of time over the course of several sessions (my players have decided they will be leaving town soon and our sessions have very little time between them in the world) he decided that he was fine with that.

I really don’t think that he will be and I’d hate to lose one of my players because in two session’s time he decides that he is really bored and doesn’t want to keep playing but on the other hand I really don’t feel like it’s fair for the other players just to give him what he wants immediately because I’m scared to lose a player.

I know he has said that he is fine with it and I’ve explained the downsides to doing what he is planning to do.

As the DM, is there a better way that I can damage control this? I don’t know if I’m making the right choices by not giving the player what they want but I just cannot see a reasonable way that a player could quickly find a rare animal in hundreds of square miles of forest.

Has it ever been officially stated how long it takes for a soul to transform into an outsider after death?

Okay, correct me if I’m wrong:

In the Pathfinder Universe, souls travel along the River of Souls after death, then hang around Pharasmas Boneyard for a while, get judged and then get send to whichever Outer Sphere plane matches their alignment. There, they become so-called petitioners, suffer/enjoy themselves for a while and with sufficient piety/malice/effort, eventually turn into a plane-appropriate outsider.

Now, has is ever been stated how long this process roughly takes? Years, decades, centuries, millennia? The only reference to time I found was about hammer archons:

Those archons who continually proves themselves in battle, either by striking down hordes of demons or by holding back a single pit fiend long enough for reinforcements to arrive, may get promoted to the rank of hammer archon. This process can take centuries, even millennia, but the lawful-aligned outsiders would brook no shortcuts. Many hound archons and shield archons with martial inclinations ceaselessly endeavor to rise to the heights of power that being a hammer archon represents.

But this is more about “rising in the ranks”, so to speak. And “brook no shortcuts” implied that shortcuts are apparently a thing(?).

(Honestly, the most interesting question to me is – would it be feasible for someone’s wise old mentor figure to return as an archon or for a former BBEG to reappear as a devil? I know they don’t really keep any proper memories of their old selves, but it would still be cool!)

[ Politics ] Open Question : After Biden takes over what kind of reality show will Trump try & do? What about ‘Trump’s Pandemic’?

100 contestants are thrown onto Jeffrey Epstein’s Island.  10 of them have Coronavirus and need ventilators.  Testing isn’t allowed and contestants can only eat KFC or McNuggets but they are not allowed to hide in the Islands bunker and are cut off from Twitter.  Whoever can find Epstein’s old disinfectant supplies and inject themselves first wins — something like that… 

What things SQL Server takes backup of when we run a full backup

Like I am trying to ask that, suppose we run a full backup using GUI or T-SQL, which file SQL Server takes backup of i.e, only data file or log file as well.

I have read that it takes active transaction portion (Log File) of SQL Server as well. please confirm.

If yes, then what will happen to a transaction that was running at that time, and committed next, logs of the transaction will there on backup or not.

how will sql server revert back to it, if the database fails.

Why does WAL on postgresql takes so long to replay?


I’m running postgresql 11 using the official postgresql docker image. The configuration is the default one without any tweak. Sometimes, my docker server crashes and kills all the container with it. As a result the postgresql gets stopped in a dirty way and postgresql has to replay the WALs. It takes more than 1h to replay the logs thought the server is mostly idling. I mean when the server crashed it hardly had any writes in the logs. And when I check in pg_wal I only see 65mb of data in the directory so it shouldn’t take so much time to replay.

Here’s some configurations:

max_wal_size: 1gb min_wal_size: 80gb checkpoint_timeout: 3min 

So how come it take so long to restart? I have a different server with much less databases but similar configurations. Both are mostly idle all the time but the other one quickly restart while they have the same configuration.

Who takes damage when Shield Warden is used?

The Champion feat Shield Warden allows a character to use their reaction to shield an ally. The feat says:

… When you have a shield raised, you can use your Shield Block reaction when an attack is made against an ally adjacent to you. If you do, the shield prevents that ally from taking damage instead of preventing you from taking damage, following the normal rules for Shield Block.

Emphasis mine. What isn’t clear to me is who takes damage when I use Shield Warden, me or my ally. The text says it uses the normal rules for Shield Block, which say:

You snap your shield in place to ward off a blow. Your shield prevents you from taking an amount of damage up to the shield’s Hardness. You and the shield each take any remaining damage, possibly breaking or destroying the shield.

This is unhelpful, because “you” refers both to the person taking damage and the person using Shield Block.

So who takes damage when I use Shield Warden: me or my ally?