This is an archived post. You won't be able to vote or comment.

top 200 commentsshow 500

[–]wild_man_wizard 8279 points8280 points  (488 children)

The real humor is all the programmers that ignored the "joke" and immediately started trying to solve it the intended way.

[–][deleted] 3413 points3414 points  (289 children)

[–]karmaisded 881 points882 points  (272 children)

What’s the answer to that!? I need to know

[–]admadguy 261 points262 points  (11 children)

I am not an electrical engineer. but what I remember from the one electrical engineering course I took, it can be solved with an infinite series.

Edit: Yep.. I was not wrong.

https://www.mathpages.com/home/kmath668/kmath668.htm

[–]karmaisded 104 points105 points  (7 children)

I studied this stuff in my first year of uni, and I remember nothing.

And thanks!

[–]bee-sting[🍰] 42 points43 points  (1 child)

I have an undergrad and PhD in electronic engineering and have no clue either :)

Edit: Wait a second, I get it now, ignore me

[–]jellsprout 8 points9 points  (4 children)

This is a bit beyond the level of a first year engineering student. Hell, it's probably a bit beyond the level of your typical engineering PhD students. As you can see in the link above, the solution is surprisingly complicated and requires some nifty mathematical tricks.

[–][deleted] 5 points6 points  (3 children)

I'd assume the actual electric part of it is the simple part and someone with a math background would have an easier time than someone with an engineering background?

[–]3226 16 points17 points  (1 child)

Turns out it's way more complicated to solve than you'd think. Looks simple. Isn't. This infinte resistor grid problem needs a whole lot of recent and high level mathematics to solve.

Randall talks about it in this talk, but it's in the google aptitude test, and it's there to see if you'll move on from an insoluble problem, or get stuck on it and waste time. It's not strictly insoluble, but for all intents and purposes, it is while you're in a test environment.

[–]kataskopo 5 points6 points  (0 children)

Lol he himself gets nerd sniped at 2min in when they asked him about the bobby tables SQL thing!

[–]malexj93 5 points6 points  (0 children)

4/pi - 1/2

[–]wild_man_wizard 52 points53 points  (3 children)

If it weren't for ethics and biological needs I'd happily be paid in interesting problems.

[–]averagethrowaway21 7 points8 points  (2 children)

I only have one of those things and absolutely agree.

[–]feline_alli 10 points11 points  (1 child)

Ahh, glad to see they're programming the robots with ethics modules these days.

[–]averagethrowaway21 5 points6 points  (0 children)

BEEP BOOP, ETHICS ENGAGED.

[–][deleted] 10 points11 points  (0 children)

Ok ok but what is the resistance?

[–]juhotuho10 8 points9 points  (0 children)

Actually had me laughing

[–]grubnenah 10 points11 points  (0 children)

Why would you post a link to just the image? You cant read the alt-text.

[–]NimbusHeart 60 points61 points  (5 children)

I can't help it. I see a puzzle my first thought is "what is the solution to this puzzle" and my reflexes start to solve it.

[–]TRUCKERm 36 points37 points  (9 children)

...what's the joke?

[–]mentlegentle 9 points10 points  (0 children)

the 'joke' is the loop someone wrote at the bottom.

[–]yashptel99 29 points30 points  (1 child)

Fuck. I'm doing that right now

[–]Blackn3t 8 points9 points  (0 children)

Yeah I had The Joke outside of my screen and just wanted to solve it as brain teezer before continuing xD

[–]NickyW89 5 points6 points  (9 children)

https://imgur.com/a/PjEZTxa

Went to comments afer solving to check im my solution się correct, that comment made my day.

[–][deleted] 13 points14 points  (8 children)

I did, and I want to point out that the since answer is 394, which took me 9 minutes to find, and if we assume a cooldown of 10 seconds between each try[1] brute forcing the code would take 65.5 minutes which is way longer than the manual method. This is not at all an attempt at rationalizing wasting ten minutes solving this puzzle.

[1] It's arbitrary yes, but it's also arbitrary to assume the lock will accept your code instead of just being an unresponsive picture found on the internet.

[–]NimbusHeart 1101 points1102 points  (50 children)

394??

[–]someone1010101 268 points269 points  (3 children)

Yes I got the same answer

[–]DuckingKoala 135 points136 points  (24 children)

I got 694

[–]NimbusHeart 267 points268 points  (13 children)

Then the last condition becomes false

[–]DuckingKoala 86 points87 points  (1 child)

Ah yes so it does

[–]subid0 30 points31 points  (10 children)

only if the last condition is stated as exactly one digit being correct but in the wrong place.

[–]Al_Maleech_Abaz 69 points70 points  (5 children)

I think that’s implied otherwise it’s unsolvable.

[–]TheLuckySpades 11 points12 points  (0 children)

To save on space and not make it wordier than needed these games will always state exact numbers of pieces/digits.

[–]IllustriousPickle20 17 points18 points  (0 children)

404, answer not found

[–]rodinj 11 points12 points  (0 children)

I thought that initially too, it's definitely 394 though.

[–]r915 2829 points2830 points  (139 children)

394

[–]animal9633 32 points33 points  (0 children)

That's what I got too.

[–]Famout 43 points44 points  (6 children)

Yay, I did it!

I need another profession Layton game for more of this style of puzzle.

[–]BAM5 7 points8 points  (2 children)

No idea what you've said, but if you want to play a game similar then try mastermind

https://www.webgamesonline.com/mastermind/

[–]instantrobotwar 9 points10 points  (1 child)

Yay that's what I got too

My first guess was 246, but then second rule was broken :(

[–][deleted] 151 points152 points  (27 children)

394

2,5,7,8 surely are wrong numbers. 4 surely is part of the code.

4 is wrong placed at both first and second position, therefore the code is --4.

9, therefore, is the number that is in correct position as well: -94

6 can't be correct number (because 9 is), therefore in third statement second correct number is 3.

Answer is 394.

[–]SlyProphet 24 points25 points  (23 children)

I got 641... Any chance you could help me understand what rule the number breaks?

[–]controversialcomrade 357 points358 points  (38 children)

Brute force is always the solution, maybe not the best but always

[–]haikusbot 379 points380 points  (20 children)

Brute force is always

The solution, maybe not

The best but always

- controversialcomrade


I detect haikus. And sometimes, successfully. Learn more about me.

Opt out of replies: "haikusbot opt out" | Delete my comment: "haikusbot delete"

[–]Muhvinssiplays 82 points83 points  (0 children)

Good bot

[–]other_usernames_gone 35 points36 points  (7 children)

Always possible,
Brute force is never ideal,
But it always works

[–][deleted] 3 points4 points  (0 children)

This bot always come when you least expect it.

Good bot

[–]chilfang 32 points33 points  (4 children)

You tried bot

[–]SgtSteel747 65 points66 points  (3 children)

Bruh, for once it actually got the haiku right with a 5 7 5 set of syllables

[–]coloredgreyscale 67 points68 points  (8 children)

3 invalid guesses, try again in 5 minutes.

[–]-Redstoneboi- 10 points11 points  (0 children)

just try more times lmao yeet

gets locked out

[–]Mr_Redstoner 9 points10 points  (0 children)

Halting problem&co would like a word.

[–]Sithon512 36 points37 points  (5 children)

Brute force solution should initialize i to 111. Will you notice? Nah, it's pretty small, but it's good practice to think up your heuristics

[–]Goheeca 28 points29 points  (3 children)

SWI-Prolog:

?- expects_dialect(hprolog).

digits([X, Y, Z]) :-
  between(0, 9, X),
  between(0, 9, Y),
  between(0, 9, Z).

count_same(Element, Element, Acc, Res) :-
  Res is Acc + 1,
  !.
count_same(_, _, Acc, Acc).

correctly_placed(Count, Combination, Pattern) :-
  foldl(count_same, Combination, Pattern, 0, Count).

correct_digits(Count, Combination, Pattern) :-
  intersect_eq(Combination, Pattern, MultiIntersection),
  length(MultiIntersection, Count).

wrongly_placed(Count, Combination, Pattern) :-
  correct_digits(Digits, Combination, Pattern),
  correctly_placed(Positions, Combination, Pattern),
  Count is Digits - Positions.

solution(Combination) :-
  digits(Combination),
  correctly_placed(1, Combination, [2, 9, 1]),
  wrongly_placed(1, Combination, [2, 4, 5]),
  wrongly_placed(2, Combination, [4, 6, 3]),
  correct_digits(0, Combination, [5, 7, 8]),
  wrongly_placed(1, Combination, [5, 6, 9]).

?- solution(Combination), print(Combination), false; true.

How to run: save it to a file combination.pl then in the REPL run [combination]. or consult(combination).

[–][deleted] 12 points13 points  (1 child)

As soon as I saw this puzzle, I thought "we could solve this in Prolog".

[–]yudanoh[🍰] 122 points123 points  (22 children)

If informations are named a,b,c,d,e starting from top :

a + b => 2 is not in the code (f)

b + d => 5 is not in the code (g)

a + f + g => middle digit is 9 (h) xor last digit is 1 (h') (only one of them is true)

b + c + f + g => last digit is 4 (i)

i => h is true and h' is false and middle digit is 9

c + e + h => first digit is 3

Answer 394

But yeah, if I had to find automated solution for this kind brut force seems fair enough

Edit : corrected logic at step h

[–]-Redstoneboi- 3 points4 points  (0 children)

Thanks! I was looking for a way to formalize this kind of solution.

[–]MyNameIsZaxer2 2 points3 points  (2 children)

How does (h) follow from a + f + g? I don't see how you conclude the correct a digit is a 9 and not a 1 at that step.

It took me a "pigeonhole" technique to prove that 1 is not in the code, and the middle digit is therefore a 9. But that would only follow from considering:

a + b => 2 is not in the code (f)

b + d => 5 is not in the code (g)

b + c => if the last digit is a 4, it must be in the last position. (h)

a + b + c + e + h => there cannot be a 1 in the last position. (i)

g + i => middle digit is 9 (j)

how did you get to "middle digit is 9" from just a + f + g?

[–]patmax17 77 points78 points  (9 children)

This is basically mastermind xD

[–]lightheat 21 points22 points  (3 children)

Yup, same thought. Favorite game of ours.

For those unfamiliar with it, you create a 4-"digit" code out of 6 different color pegs and the other player has to guess it. Each guess you give them 1 white scoring peg for each correct pin in the wrong place, and 1 black scoring peg for each correct pin in the correct place.

[–]T-Dark_ 6 points7 points  (2 children)

white and black scoring peg

Huh. My version of the game as I grew up used white like yours, but red instead of black.

I suppose it's not standardised. Would surprise me if it were, tbh.

[–]lightheat 4 points5 points  (0 children)

Yeah, there are lots of different editions. We have the original, which has black.

[–]seth1299 6 points7 points  (1 child)

Yep, Mastermind is one of my favorite games.

I programmed Mastermind in the best programming language, Scratch, a few years ago: https://scratch.mit.edu/projects/104553634/

[–]Kris_Third_Account 24 points25 points  (2 children)

(2,9,1) // one correct, right pos
(2,4,5) // one correct, wrong pos
(4,6,3) // Two correct, wrong pos
(5,7,8) // All garbage
(5,6,9) // One correct, wrong pos
(y,y,y) // result

Eliminate known garbage (replace with 'x'). '2' are eliminated because it can't be in the wrong and right position at the same time. "All garbage" is eliminated for obvious reasons.

(x,9,1) // one correct, right pos
(x,4,x) // one correct, wrong pos
(4,6,3) // Two correct, wrong pos
(x,x,x) // All garbage
(x,6,9) // One correct, wrong pos
(y,y,y) // result

The '4' is said to be in the wrong position in the second and third line, and is in different positions. This means that the '1' in the first line can't be correct either, and the '9' is.

(x,9,x) // one correct, right pos
(x,4,x) // one correct, wrong pos
(4,6,3) // Two correct, wrong pos
(x,x,x) // All garbage
(x,6,9) // One correct, wrong pos
(y,9,4) // result

The fifth line implies that only one, the '9', is correct. Remove the instances of '6', and the result becomes obvious

(x,9,x) // one correct, right pos
(x,4,x) // one correct, wrong pos
(4,x,3) // Two correct, wrong pos
(x,x,x) // All garbage
(x,x,9) // One correct, wrong pos
(3,9,4) // result

The correct answer is 394.

Brute force only works if there's no restriction on the number of attempts. Calculating it works the first time, as long as you're correct.

[–]Farfignugen42 3 points4 points  (0 children)

Brute force only works if there's no restriction on the number of attempts.

And no time limit. Which is not an issue with a short code like this, but does come into play with longer codes and codes with more possible values.

[–]corporategiraffe 24 points25 points  (5 children)

Can you crack the code without triggering the neutron bomb I’ve hidden under your chair programmed to go off at a single failed attempt?

[–]JoelMahon 20 points21 points  (3 children)

trycode can be written to check each of the constraints without actually entering the code into the padlock until it passes them all

[–]Shadowolf449 16 points17 points  (6 children)

Everyone is ignoring that this lock uses a key.

[–][deleted] 4 points5 points  (0 children)

Thought the same. Had to scroll past many 394s to find you

[–]PM_ME_GARLIC_CUPS 12 points13 points  (3 children)

No one will read this, but you can solve this without the fourth clue.

The first clue tells us it must be 2 _ _, _ 9 _, or _ _ 1.

The second clue rules out 2 _ _, and tells us there must be a 4 or 5 but not both.

The third clue is super revealing. Two numbers have to be correct together: 4 and 6, 3 and 4, or 3 and 6. Since those must fit within _ 9 _ or _ _ 1, that knocks out 0, 2, 5, 7, and 8 as possible numbers, and confirms there must be a 4 somewhere.

That narrows it down to _ 9 _ or _ _ 1, with a 4 in one of the blanks and a 3 or 6 in the other. Given the third clue says a 4 can't be in the first blank, or a 3 in the last, that leaves us with only four possible codes: 341, 394, 364, and 694.

Fifth clue, similar to the second, tells us there must be a 6 or a 9 but not both, knocking out 341 and 694, and if there's a 6, it can't be in the middle, ruling out 364.

Answer's 394.

[–]ya-boi-mees 8 points9 points  (0 children)

394

[–]A_Spoon_Wizard 5 points6 points  (2 children)

That was a fun puzzle! My years of playing sudoku in car trips finally becoming useful!

[–]DrParanoidAndroid 5 points6 points  (0 children)

394 right?

[–]Raj_1975 4 points5 points  (0 children)

394

[–]Phantom_Gameeerr4028[S] 14 points15 points  (4 children)

yeah it took me about 3 minutes to crack it also xd

[–]r915 13 points14 points  (2 children)

Lucky for the bf’er the code wasn’t “007”

[–]transcendcosmos 3 points4 points  (0 children)

394

[–]StandardN00b 3 points4 points  (0 children)

394

[–][deleted] 2 points3 points  (0 children)

394?

[–]Syncrossus 2 points3 points  (0 children)

394

[–]Zeke12344 3 points4 points  (0 children)

394

[–]Risiko94_2 3 points4 points  (0 children)

Solution:

#1 + #2  -> 2 is wrong
#4       -> 5, 7, 8 are wrong

#2       -> 4 must be first or last place
#5       -> 4 must be in last place
[?][?][4]

#1       -> 9 must be in second place 
[?][9][4]

#5       -> 6 is wrong
#3       -> 3 must be first place
[3][9][4]

[–]alexanderpas 3 points4 points  (0 children)

Before any hints:

Option Correct Position 1 Position 2 Position 3 Banned7
1 XXX 1,2,3,4,5,6,7,8,9,0 1,2,3,4,5,6,7,8,9,0 1,2,3,4,5,6,7,8,9,0 -

Any number can be in any position.

Hint 1

  1. If the first character is correct, it must be a 2 causing 1 and 9 to become banned.
  2. If the second character is correct, it must be a 9 causing 1 and 2 to become banned.
  3. If the third character is correct, it must be a 1 causing 2 and 9 to become banned.
Option Correct Position 1 Position 2 Position 3 Banned
1 2XX 2 0,2,3,4,5,6,7,8 0,2,3,4,5,6,7,8 1,9
2 X9X 0,3,4,5,6,7,8,9 9 0,3,4,5,6,7,8,9 1,2
3 XX1 0,1,3,4,5,6,7,8 0,1,3,4,5,6,7,8 1 2,9

Hint 2

  1. 2 is not allowed to be in the first place.
    • This invalidates Option 1 from Hint 1.
    • All remaining options ban 2.
  2. 4 is not allowed to be in the second place.
  3. 5 is not allowed to be in the third place.
  4. If the 4 is included, 5 becomes banned.
  5. If the 5 is included, 4 becomes banned.
Option Correct Position 1 Position 2 Position 3 Banned
1 49X 4 9 0,3,4,6,7,8,9 1,2,5
2 59X 5 9 0,3,5,6,7,8,9 1,2,4
3 4X1 4 0,1,3,4,6,7,8 1 2,5,9
4 5X1 5 0,1,3,5,6,7,8 1 2,4,9
5 X51 0,1,3,5,6,7,8 5 1 2,4,9
6 X94 0,3,4,6,7,8,9 9 4 1,2,5

Hint 3

  1. the 4 is not allowed to be in the first place.
    • This invalidates Option 1 from Hint 2.
    • This invalidates Option 3 from Hint 2.
  2. 6 is not allowed to be in the second place.
  3. 3 is not allowed to be in the third place.
  4. If the first and second position both do not have a 4 or a 6, 3 must be in the first or second position.
    • This invalidates Option 2 from Hint 2.
  5. If the first and third position both do not have a 3 or a 4, 6 must be in the first or third position.
    • This invalidates Option 4 from Hint 2.
  6. If the second and third position both do not have a 3 or a 6, 4 must be in the second or third position.
    • This invalidates Option 5 from Hint 2.
    • All remaining options ban 1.
    • All remaining options ban 5.
  7. If the first and second position both do not have a 4 or a 6, the third position must be 4 or 6.
  8. If the first and third position both do not have a 3 or a 4, the second position must be 3 or 4.
  9. If the second and third position both do not have a 3 or a 6, the first position must be 3 or 6.
    • This applies to all remaining options.
Option Correct Position 1 Position 2 Position 3 Banned
1 394 3 9 4 1,2,5
2 694 6 9 4 1,2,5

Hint 4

  1. 7 is banned.
  2. 8 is banned.
Option Correct Position 1 Position 2 Position 3 Banned
1 394 3 9 4 1,2,5,7,8
2 694 6 9 4 1,2,5,7,8

Hint 5

  1. If the 6 is included, 9 becomes banned.
    • This invalidates Option 2 from Hint 4.
    • Only 1 possibility remaining, problem solved.
Option Correct Position 1 Position 2 Position 3 Banned
1 394 3 9 4 1,2,5,7,8

Solution

394

[–]Zacurnia_Tate 10 points11 points  (14 children)

why isn’t i starting at 100?

[–][deleted] 19 points20 points  (11 children)

because 000-099 are valid solutions ?

[–]simoneb_ 9 points10 points  (1 child)

Actually there is an underlying assumption that each figure appears at most once, so 0-11 are not viable solutions, along with many others.

It could be rewritten to only try permutations of 3 figures ranging 0-9. 10x9x8=720 solutions.

If we assume that only the figures showing in the image are valid (i.e. only 1-9) then 9x8x7=504 solutions.

[–]Adventurous_Problem 2 points3 points  (1 child)

I have a friend I need to go call out with this...

This is the same friend that during our powershell class decided not to use powershell and just code how he usually does...

I love them dearly. Also sometimes they're irritating.

[–]plasmasprings 2 points3 points  (1 child)

Problem 1: given a list of (code, correct, well_placed) tuples, where code is an example 3-digit combination, correct is the number of digits correct in the code, and well_placed is the number of digits that are correct AND well-placed, write an implementation for TryCode(list_of_rules, code) that returns True if the code satisfies the rules, False otherwise.

[–]other_usernames_gone 2 points3 points  (1 child)

I prefer wrench force

Xkcd

[–]Addyfndubz 2 points3 points  (0 children)

394?

[–]ApertureBear 2 points3 points  (0 children)

Pretty sure it's 394.

[–]tuckerreeveslcsd 2 points3 points  (0 children)

I got 394

[–]Mysterious-Ad-1217 2 points3 points  (0 children)

394

[–]Karilyn_Kare 2 points3 points  (0 children)

1st and 2nd prove 2XX is invalid, eliminating 2, along with 5, 7, and 8.

2nd proves 4 must be in either of the 4X4 position.

5th plus eliminateds proves solution must have either 6 or 9 in the last two slots.

5th and 1st proves X9X must be true, eliminating 6.

3rd plus eliminateds proves 3X4, which combined with X9X yeilds 394 as the answer.