Suppose you had a 13 hour clock, labeled 0 to 12. Start at 0 and go counterclockwise 104
hours (since you went counterclockise, that's -104 hours. Youl'll find
yourself ack at 0 (since 104/13=8). But wait, we
went too far, so go clockwise 3 hours and we'll see that the clock
reads 3 for...
-------------------------------------
It's a dwarf integer.
Dammit, why does it complain that my message is too short?
Here I'm trying to post a witty response and I have to put up with this crap. Dammit, still need 4 more characters. Oh wait, I just realizes, my message was too...
Oh, I forgot to mentio: if you don't like A=1, pick another.
In a linear congruence, if A is a solution, so is A+Y,
or A+nY, for that matter. So we can chose any A, as
long as it's a multiple of four plus one.
For instance, we can pick A=1001 and recalculate B
(B=834), giving us: 1001*9...
To solve for 12345, re-arrange your formula to
(AX-M)/Y=-B
In this form, iy's a Linear Congruence, so you can use the Modular Inverse
of X&Y to find A as follows:
A = invert(X,Y)*M (mod Y) = 1*12345%4 = 1
then solve fo B: (1*9-12345)/4=-B
-3084 = -B
B = 3084
Be careful, though. You CAN...
Good. Now you know that the successor of 0mod4 is 1mod4. Now you just need to find the successor of 1mod4. When you have figured out the successor rules, you just need to find the initial state. Then, with the successor rules in hand, you can build a state machine. As uou already know, not every...
Stand on a N/S sidewalk. Call North the positive direction. Spin about
and face South (the negative direction). Now take 2 steps backwards.
That's negative motion in the negative direction, yet you end up
farther North of your starting point. Negative motion in the
negative direction yields...
Sorry abput that. The correct count was, in fact, 22. I seemed to have omitted a number in the sequence. 7894631, 789262, 15789266, 831056, 103898,
103902, 34644, 5788, 2902,2906,2910, 214, 218, 222, 84,28,22,26, 30, 20, 18, 16
I wrote a Python program that checked out to 10,000,000. Found a sequence of
length 22: 7894631,15789266,831056,103898,103902,34644,5788,2902,2906,2910,214,218,
222,84,28,22,26,30,20,18,16.
You can use a simple lookup table to convert a hex character to its binary equivalent:
0:0000 1:0001 2:0010 3:0011
4:0100 5:0101 6:0110 7:0111
8:1000 9:1001 A:1010 B:1011
C:1100 D:1101 E:1110 F:1111
Number theory would still be useful, it's just that you might not be able to make certain assumptions. Things like The Fundamental Theorem of Arithmetic would still hold.
Additionally, your examples are only 4 letters, not 5.
As shown above, you just need the pattern xy and pair it with it's reverse to get xyyx.
How many xy patterns are there? That's the Cartesian Product of 4 letters taken 2 at a time.
That would be (length of alphabet) * (length of...
But don't forget - you are making the assumption that you will ALWAYS be given the opportunity to switch. If not, then "win 2/3 of the time by switching" does not necessarily apply.
Finding out is a doddle.
import random
hist = {'won':0, 'lost':0}
for i in range(10000):
game = ['c','g','g','g']
p = game.pop(random.choice(range(4)))
game.remove('g')
game.remove('g')
# always switch
p = random.choice(game)
if p == 'c':
hist['won'] += 1...
I didn't say it would. But IF I don't have the formula at hand AND Wikipedia is not available, THEN I prefer my answer as there's nothing stopping me from obtaining it and it's good enough. The difference between 29.29 and 29.5 is just splitting hairs.
By randomly selecting numbers in the range (0-9) and storing them in a dictionary. When the length of the dictionary reaches 10, there must be a least 1 of every value. At that point, the sum of the dictionary is the number of draws. On some runs, it might take only 17 draws to get all 10, other...
You would need to know the distribution of the toys. Are there more toy cars than toy boats? Obviously, if it's not uniform, you would have to buy a lot more to get one of each.
When you hold a micro-phone next to the speaker, it tries to become infinitely loud. Of course, it can't, so it oscillates (that's that high pitched feedback squeal you hear).
Then again, there's Fermat's Little Torte.
Start with a 5x5x5 cube of cupcakes.
Remove one corner column (1x1x5) and note the remaining cupcakes can be divided by 3 (24 1x1x5 columns).
Reassemble into a 4x4x4 cube.
Remove another corner column and note they can still be divided by 3...