Post all the logic and math puzzles you know, or post your solutions to the following ones.
>You want to buy a dog so you call the owner of the pet store. You ask the owner if they have any dogs and he says yes we have two. You then ask him if one is a male, he says yes. Assuming all dogs are either male or female, what is the probability the other dog is male.
>A bacteria culture in a petri dish doubles every hour. If the dish is full 8 hours after the experiment starts, when was it half full?
>How many bit strings of length 10 contain either 5 consecutive 1s or 5 consecutive 0s
>Suppose 21 boys and 21 girls enter a math contest. Furthermore, suppose that each entrant answers at most 6 questions, and for every boy-girl pair, there is at least one question they both solved. Show that there is a question that is solved by at least 3 girls and 3 boys
>How many ways are there for a four horse race to finish if draws are allowed?
>The amount of particles in the universe was estimated to be 33*2^257, how many digits are in this number?
>Find a constant time algorithm which sums the digits of an inputed positive integer.
>Given an nxn chessboard where n is a positive integer, write a constant time algorithm which determines the number of squares on this chessboard.
>Given a mxn rectangular grid where m and n are positive integers, how many rectangles does it contain?
>What is the probability that a five card poker hand contains cards of five different kinds and does not contain a flush or straight?
if you are looking for more puzzles, some user suggested these
Parker Rogers
>1/3 >7 hours >222 >Answer too long to fit here >75 >79 >Impossible >Return: ((1/3) n^3 + (1/2) n^2 + (1/6) n) >[math] {m \choose 2} {n \choose 2} [/math] >~50%
Sebastian Wilson
Assume + - * / and % are all constant time
Adam Thomas
I'm trying to tackle a problem posted in the previous puzzles thread :
find the area of the sequence of circles tangent to the two semi-circles, and tangent to each previous circle (the first one, drawn in blue, is tangent to the 0x line), going toward A.
I could find the parameters of the first circle (by solving the equation saying that A1 is at the same distance of the two semi-circles and the 0x line.
I tried to derive a general formula to get the coordinates of the center of the next circle, but wolframalpha just gave me an overly complicated answer.
Maybe I could find the equation of the line containing the center of the circles.
>LOL U USED A BUILT IN TO IMPLEMENT A TRIVIAL THING?
Nathaniel Thompson
they think reinventing the wheel makes them hardcore [spoiler]obviously they didn't read SICP[/spoiler]
Josiah Brown
>WOOOOW You made Prolog in LISP. Anyone can do that. Now try to implement it from scratch
Dylan Johnson
There's a type of joy and wonder that comes from discovering this type of answer for oneself.
Owen Jenkins
>divided by log base 10 of 10
Luis Perez
He made no indication that he did.
Lucas Evans
[eqn] \log(x) = \int_0^x \frac{dt}{t} [/eqn]
Matthew Walker
Typo. The lower bound of the integral should be 1.
Jacob Sanchez
>>Given an nxn chessboard where n is a positive integer, write a constant time algorithm which determines the number of squares on this chessboard. wouldn't this just be n^2? sorry for brainlet
Hudson James
it's [math] \Sigma_{k = 1}^n \left( \begin{array}{c}n \\ k \end{array} \right) [/math] Squares can be 1x1, 2x2, etc.
Dominic Murphy
ohhh i see now, thanks. I thought it meant only the little black and white squares.
Angel Campbell
>Find a constant time algorithm which sums the digits of an inputed positive integer.
Inputed into what? If we use a (limited size) variable, we could calculate the value for all possible digits even when they are zero, and get an equal running time for all possible inputs. This could arguably be done even if we read the input as a string. Memory is not unlimited.
The cheat would be to define the algorithm to calculate all digits up to infinity. The definition of the algorithm would be constant time, even if it could never finish.
Julian Hughes
There are n^2 squares of the size 1x1. There are (n-1)^2 squares of the size 2x2. ... There is 1 square of the size nxn.
Total number is thus [eqn]\sum_{k=1}^n k^2 [/eqn]
Charles Campbell
>>How many bit strings of length 10 contain either 5 consecutive 1s or 5 consecutive 0s
Fun problem.
First consider a string of 5 consecutive 1s. There are 5 possible configurations for the 5 consecutive 1s, but all of them leave 5 open spots.
For each configurative of consecutive 1s, we can add the possibilities for the remaining parts as such:
Because in 5 choose 0 we are choosing 0 1s, which generates the string 00000 In 5 choose 1 we are choosing 1 1s so we generate strings like 10000, 01000, etc.
And so on. And my trustworthy calculator tells me that sum equals 32.
But for each configuration of 11111s, we have 5 arrangements of empty spots, so we multiply 32*5 = 160
For the case of 5 consecutive 0s it is the same. We get 160 configurations.
Then to find the total we add them but we need to substract one of each configuration which occurs in both lists. So we need to remove every list that contains 5 consecutive 1s and 5 consecutive 0s.
Luckily we can generate those lists easily: 0000011111 and 1111100000 and they are only two se we compute 160 + 160 - 2= 328
Joseph Torres
You're counting the strings with 6 or more consecutives 1s several times.
Jose Nguyen
Here's a nice one: if you write down all the numbers from 1 to 1 million, how many times will you write down the number 2?
Carson Bennett
>>How many bit strings of length 10 contain either 5 consecutive 1s or 5 consecutive 0s I'll try to take on it.
Let's count only zeroes:
First case, the string is in the beginning: 00000***** => 32 possibilities Second case. The sequence starts at second element, but we have to exclude the first, therefore: 100000**** => 16 possibilities
Same with ones: 112. However, some cases still overlap, them being 0000011111 and 1111100000.
So, the answer is 112 * 2 - 2 = 222
Blake Cox
From 1 to 10: 1 From 10 to 100: Each time 2 is in the first digit (10 times: 12, 22, 32...) and each time 2 is in the second digit (10 times: 20,21,22...) = 20 From 100 to 1000: First digit: 100 Second digit: 100 Third digit: 100 = 300 Et cetera. So, the answer: 654321 times.
Robert Carter
>>You want to buy a dog so you call the owner of the pet store. You ask the owner if they have any dogs and he says yes we have two. You then ask him if one is a male, he says yes. Assuming all dogs are either male or female, what is the probability the other dog is male.
Single events dont have probability. Genderdistribution is not specified.
>>A bacteria culture in a petri dish doubles every hour. If the dish is full 8 hours after the experiment starts, when was it half full?
Could have been full one hour after start, unless it was first full after exactly eight hours.
Leo Jenkins
>Single events dont have probability. Look! It's a frequrntist! Let's laugh at him!
Jaxon King
/3 no its not
Ryder Harris
axiomatic-math-fag
Brandon Richardson
Nope
Tyler Gutierrez
Oh whoops that's 10 million
Still nope though
John Miller
>instead of log base 10 of X+1 over log base 10 of 10, which equals log base 10 of X+1, we consider log base e of X+1 over log base e of 10, which equals log base 10 of X+1 by a well-known result Fuck off
Caleb Nelson
Oh yeah, I fucked up. From 10 to 100 in the first digit 2 appears only 9 times, that is, 19 times. To fix: 1..10: 1 1..100: 20 1..1000:300 ... 1..1000000: 600000
Anthony Walker
Because it defeats the purpose of the challenge. All you did was look up the answer. These questions aren't asked because they're open problems without solution, they're asked to see if you can puzzle it out on your own.
Anthony Rodriguez
You wouldn't get the job. There's a much more direct elegant way of getting this which also shows that it doesn't depend on the digit (could be 3 instead of 2), and also immediately shows how to generalise. You should immediately see that the answer in the case 1 to 1 million is 6*10^5 for any digit other than 1. More generally in the case of 1 to 10^k it's k*10^(k-1).
Angel Anderson
>1/3 what? genders = 2 probably of 1 over the other is 1/2 first dog is established as male, meaning that the probably of both being male is 1/2 x 1/2 = 1/4
Isaac Jackson
Every problem is either a solved problem, in which case you can google the solution, or an unsolved problem.
Adrian Thomas
found the stack exchange coder
Isaiah Sanchez
That is exactly what I've shown, I just didn't explicitly write the formula.
Sebastian Thompson
>genders = 2 user, I'm from the bureau of social justice and I'd like to ask you some questions about a post you made on an online forum. I was hoping you could invite me into your home and we could have a discussion.
Elijah Turner
You are the reason why some textbooks have foregone including solutions to problems.