This discussion board is a place to discuss our Daily Challenges and the math and science
related to those challenges. Explanations are more than just a solution — they should
explain the steps and thinking strategies that you used to obtain the solution. Comments
should further the discussion of math and science.
When posting on Brilliant:
Use the emojis to react to an explanation, whether you're congratulating a job well done , or just really confused .
Ask specific questions about the challenge or the steps in somebody's explanation. Well-posed questions can add a lot to the discussion, but posting "I don't understand!" doesn't help anyone.
Try to contribute something new to the discussion, whether it is an extension, generalization or other idea related to the challenge.
Stay on topic — we're all here to learn more about math and science, not to hear about your favorite get-rich-quick scheme or current world events.
Markdown
Appears as
*italics* or _italics_
italics
**bold** or __bold__
bold
- bulleted - list
bulleted
list
1. numbered 2. list
numbered
list
Note: you must add a full line of space before and after lists for them to show up correctly
# I indented these lines
# 4 spaces, and now they show
# up as a code block.
print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.
print "hello world"
Math
Appears as
Remember to wrap math in \( ... \) or \[ ... \] to ensure proper formatting.
2 \times 3
2×3
2^{34}
234
a_{i-1}
ai−1
\frac{2}{3}
32
\sqrt{2}
2
\sum_{i=1}^3
∑i=13
\sin \theta
sinθ
\boxed{123}
123
Comments
i found some interesting TedEx video about coding: Episode10. i found the last episode first, but i assume it's better to watch them from the start ;-) think like a coder
;-) ty. i didnt meant to make an official post. by accident i pressed save instead of edit.
thanks to u i know how to use notes. since then i use notes to test latex before i post it.
before i discovered this, my latex posts had a lot of post-edit-post-edit-post chains.
@num IC
i noticed you have been having problems with this Oren-Ben-Dov guy can you png me as a reply to one of his messages for me and i will leave a nice suprise making sure he does not do that again
i just wrote to him. i assume he just have no idea how to have a fruitful discusion.
i dont want you to "send a surprise". i assume talking to him makes more sense.
but it would be nice if you could teach me, how to surprise someone. ;-)
@Num Ic – Thank you, I'll remember that. This was what my post said from the shifting supports challenge:
Hi again! This was a very helpful reply and it answered my question. Thank you for helping me out (even though my question was confusing to understand) :):)
@Jonathan Eshetu nice, you found the page ;-)
since you know how to code, latex will be easy for you. when u wanna try it, i offer my help.
but anyway i just refered to this page, so we can communicate.
@Jonathan Eshetu
–
;-) here you can chat about everything. there is no off-topic delete like in the daylies.
feel free to ask. there are better coders here, but i will help as good as i can.
i created this page by accident. i just wanted to test the latex output to avoid a post-change-post-chain.
but now i keep it bcs its convenient.
print("Pick two numbers to find the greatest common divisor")a=input()b=input()cd=0a=int(a)b=int(b)ifa>b:foriinrange(1,b+1):ifa%i==0andb%i==0:ifi>cd:cd=ielse:foriinrange(1,a+1):ifa%i==0andb%i==0:ifi>cd:cd=iprint(cd)
@Jonathan Eshetu
–
what is the difference between the condition that i used and your condition?
there is an algorithm from euklid for gcd.
can you implement it as recursive function?
@Jonathan Eshetu
–
i assume u will get that in school soon too.
its about a/b = x + remainder and then divide by the remainder and repeat until the final remainder is 0.
i propose to check the web to find it. i can explain it here, but one approach to programming is to find algorithms and implement them.
@Num Ic
–
Oh ok, so I did some research.
I knew about the euclidean algorithm for finding the gcd, I just didn't know that was the name.
So you want me to implement the euclid approach in python, using recursion (calling a function within itself)?
I'll try.
@Num Ic
–
I used return at first, but I accidentally put
return a
instead of
return(a)
And nothing outputted when I called the function, so I got confused.
@Jonathan Eshetu
–
hm, as far as i know, "return a" and "return(a)" should return the same value. how did u do the box around the return ?
return just returns a value ;-).
to print it, call print(euclidGCD(34, 4))
@Jonathan Eshetu
–
yeah, the calling of your own functions is used the same way as built-in functions.
since you already created code for the daily challenges, you can also check the coding solves by other users. its a good way to get some coding experience just to read coding done by others.
carsten kaminski writes very impressive code. it sometimes took me a while to understand his cool solutions.
@Jonathan Eshetu
–
so check the other codes first. all reading of code helps to get new ideas. (i proposed carstens code just if u wanted to have a challenge.)
@Num Ic
–
I might have the wrong definition of condition, but essentially you checked if it DIDN'T work (a%i != 0 or b%i != 0), from the top down (i -= 1). This allows the program to stop when it finds a value. In my case, I checked if it DID work (a%i == 0 and b%i == 0) and went from the bottom up (for i in range(1, b+1)). Since we're looking for the GREATEST common divisor, going from the top down allows you to stop when you find a value, because that value is already the greatest possible number.
@Jonathan Eshetu
–
nice solution for the first problem.
for the second: its a nice example to show that it might cause problems if a function is used as argument for the function itself.
the return value is 3 + something. so i checked what happened if n=3.
_ = 4 will result in return 0 -> no problem
_ = 3 will result in return 0 -> no problem
_ = 2 will result in return 3+something -> might cause a problem
but you can also use a loop and call the function with different values to check the results. i do this sometimes to figure out if there might be an error.
have u checked the russian course?
The reason it's 2 is because eventually, the program will simplify to
3 + rec(3)
Because when you keep subtracting the number, it will eventually go below 0, and then everything will simplify to the above equation. But when you calculate the return value, it becomes 3 + 3 + rec(rec(3-_), and if the blank is less than 3, it will result in rec(natural number), which causes an infinite loop.
Eg.
3 + rec(rec(5-3));
3 + rec(rec(2));
3 + rec(3 + rec(rec(2-3)));
3 + rec(3 + rec(rec(-1)));
3 + rec(3 + 0);
3 + rec(3) (it always simplifies to this);
3 + rec(rec(3-3))) (since the blank is 3, the rec function goes down to 0);
3 + 0;
3;
However, if it was say 2;
3 + rec(3);
3 + rec(rec(3-2));
3 + rec(rec(1));
3 + rec(3 + rec(rec(1-3)));
3 + rec(3 + rec(rec(-2)));
3 + rec(3 + 0);
3 + rec(3);
Hence the infinite loop.
@Jonathan Eshetu
–
very good, you got it.
u can also test it in the coding environment here.
nothing bad will happen. there will just be a message that there are too much recursions.
i did the test with _=4 and n=10000.
@Num Ic
–
Oh wow. I just used IDLE to play around and see what happened. I set a variable that increased 1 for ever recursion. and then made it stop at 20 so I could review the loop.
@Jonathan Eshetu
–
yeah for local test, i used idle too. but here i use the brilliant coding environment.
have u seen that carsten proposed two webpages?
have u checked the community for coding problems, that are posted by the members?
@Num Ic
–
I've looked around here and there for problems posted by members, but everything is either WAY too easy or WAY too hard.
A website I just found out, that I'm going to use a lot now, is edabit.com. It has a bunch of different challenges anywhere from Very Easy -Expert, with a ton of different languages.
@Jonathan Eshetu
–
i do linebreaks by two spaces and then return. 4 spaces should create a linebreak too.
i had four spaces before the 4, but it seems not to work.
btw: u can test such things by creating a note.
but u can do it here too ;-)
(if the others in this chat are annoyed, they will unsubscribe this chat)
@Jonathan Eshetu
–
questions are rarely stupid. if the factorial function is called with the input 10, then it calls itself 10 times, if it is called with 100, then it calls itself 100 times. the recursion depth is how often a function calls itself until it finishes.
eg factorial 4:
remember the 4 and call f(3)
remember the 3 and call f(2)
remember the 2 and call f(1)
return 1
return the remembered 2 multiplied by 1 (=2)
return the remembered 3 multiplied by 2 (=6)
return the remembered 4 multiplied by 6 (=24)
@Num Ic
–
Now that sounds fun. Though, I'm a bit busy with schoolwork rn, so I'll make the recursion depth program and solve that problem when I get s'more work done.
@Jonathan Eshetu
–
sure. schoolwork first.
this is a proposal for a coding environment: repl.it
this is for learning: realpython.com
(the 2nd seems to be similar to your edabit.com)
@Mahdi Raza hello Mahdi Raza , you created a very nice animation in this daily problem: Sum These Segments. what tool can be used to create such an animation? or did you move the lines by hand, step-by-step?
this is great ty. i checked your pentagon. there you mentioned keynote. i thought that was only a kind of a powerpoint clone. but you are creating very impressive animations. ty for that and ty for the hint.
yeah. and it is faster, since a function call takes more time than a loop.
it is just used as a simple way to understand recursions.
you can also use carstens codes to understand recursions ;-)
ty, i didnt check realpython. i just saw that one did recommend it.
for recursion depth, a simple code is enough. just dont be affraid.
# Inputa=[]# This is an array so we can print the values if neededdefrec(n):a.append(n)ifn<=0:return0return3+rec(rec(n-3))forxinrange(1,50):print(x,"-",rec(x),len(a))a.clear()# Output1-332-333-334-675-676-677-9158-9159-91510-123111-123112-123113-156314-156315-156316-1812717-1812718-1812719-2125520-2125521-2125522-2451123-2451124-2451125-27102326-27102327-27102328-30204729-30204730-30204731-33409532-33409533-33409534-36819135-36819136-36819137-391638338-391638339-391638340-423276741-423276742-423276743-456553544-456553545-456553546-4813107147-4813107148-4813107149-51262143
@Num Ic
–
After analyzing:
1) Since it's steadily increasing, isn't the depth infinite?
2) This is crazy. If you add 1 to each of the depths, you end up with a very noticeable pattern.
4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, 64...
Why would powers of 2 appear here?
@Jonathan Eshetu
–
i have to think about the logic to understand why the powers of 2 occure here.
but there is a missunderstanding. my intention was not to check the depth of this particular function. (50 is much too low to test this one).
its more easy to use a simple function that just increases the given value.
@Jonathan Eshetu
–
hm yeah it was just an idea. i thought it might be interesting for you to know how to check the limits of python (or any ide).
currently i feel a bit incapable bcs i am not able to express that intention clear enough.
have you found some interesting tasks on edabit.com?
@Num Ic
–
There was 1 problem, something like "create a stutter function that gets a parameter, and returns the first 2 letters, ..., the first 2 letters again, ..., and then the full word with a question mark.
Ex. stutter(python) -> py...py...python?
I have the idea, I just don't exactly know how to code it.
defninjaToEnglish(phrase):engText=[]ninjaDict={"a":"ka","b":"u","c":"mi","d":"te","e":"ku","f":"lu","g":"ji","h":"ri","i":"ki","j":"zu","k":"me","l":"ta","m":"rin","n":"to","o":"mo","p":"no","q":"ke","r":"shi","s":"ari","t":"chi","u":"do","v":"ru","w":"mei","x":"na","u":"fu","z":"zi"," ":" ",}phrase=phrase.split('~')foriinphrase:forkey,valueinninjaDict.items():ifi==value:engText.append(key)engText=''.join(engText)returnengTextprint(ninjaToEnglish("chi~ri~ku~ ~ka~to~ari~mei~ku~shi~ ~chi~mo~ ~chi~ri~ki~ari~ ~no~shi~mo~u~ta~ku~rin~ ~ki~ari~ ~ari~ki~na~ ~te~ki~ru~ki~te~ku~te~ ~u~fu~ ~ri~ka~ta~lu"))#output: the answer to this problem is six divided by half (I almost put 3)
@Jonathan Eshetu
–
what does this?: engText = ''.join(engText)
and ty: i was not aware that there is no direct access from value to key.
i assume that is why they created that reverse dict in the solution.
Basically, it takes a number, returns its divisors, the sum of its divisors, and if it's a perfect number (a number where the sum of its divisors equals itself) or not.
1
2
defperfectNumberCheck(n):print(n,"\n","divisors:",' '.join(map(str,[iforiinrange(1,n)ifn%i==0]+[n])),"\n","sum of divisors (aside from itself):",sum([iforiinrange(1,n)ifn%i==0]),"\n","Perfect number:","True"ifsum([iforiinrange(1,n)ifn%i==0])==nelse"False","\n","\n")
very cool.
its possible to skip long lines by using \
and i know that for some ppl it is a challenge to solve problems in few lines, but it is more easy to read code if it is split into several commands.
and i m impressed: you already know more about how to use the print command than i do.
so i should try to catch up again ;-)
@Jonathan Eshetu
–
Here it is a bit..neater, because I assigned the divisors array so I wouldn't have to spam it.
1
defperfectNumberCheck(n):divisors=[iforiinrange(1,n)ifn%i==0]+[n];print(n,"\n","divisors:",' '.join(map(str,divisors)),"\n","sum of divisors (aside from itself):",sum(divisors)-n,"\n","Perfect number:","True"ifsum(divisors)-n==nelse"False","\n")
@Jonathan Eshetu
–
hm, i had to find some.
i really recommend the corrected coursera page that i posted. coursera learn python
that was one task i liked: korovay
it has to return correct russian word for cow (korov, korova or korovy):
For a given number n <100, finish the phrase “Grazing in the meadow ...” with one of the possible continuation: “n cows”, “n cow”, “n cows”, correctly declining the word “cow”.
Input format
A natural number is entered.
Output format
The program should print the entered number n and one of the words: korov, korova or korovy. There must be exactly one space between the number and the word.
Note
If Russian is not your native language and you find it difficult to cope with this task, you can find a hint on declensions here: https://www.coursera.org/learn/python-osnovy-programmirovaniya/programming/rsYze/korovy/discussions/threads/-FJYlWcKEeiMwRLm6nkdwA .
"n коров" if 10 <n <20 or the last digit of n is one of 0, 5, 6, 7, 8, 9.
"n корова" if the last digit n == 1.
"n коровы" in all other cases.
@Jonathan Eshetu
–
;-) yeah, the same happened to me when i translated the page.
its a double challenge to code, when the task is given in a foreign language ;-)
i saved some of the tasks, but i saved them translated to german not english ;-(
@Percy Jackson you asked for sides to learn python.
i did the free course on this page: coursera.org
it is in russian, but i translated the pages (i ignored the videos)
a member here recommended edabit.com (it seems to be a free page to learn python).
other pages:
realpython.com (might be pay to use)
repl.it (online coding environment)
@Percy Jackson ty for showing your javascript code for the candy problem.
it helped me a lot to understand javascript.
i found a nice solution to change the speed.
if you want to see it, i can post it here.
@Percy Jackson@Jonathan Eshetu
i m not sure if i linked the correct coursera course.
this is the one i did: https://www.coursera.org/learn/python-osnovy-programmirovaniya/home/welcome
@Mitch Connor
I have deleted my solution for the problem, but I apologize for the incorrect equation. I got them mixed up, which is completely my bad. Thanks for telling me!
I can't stay for long, so sorry if i don't respond, but say I was making a text rpg in python
in this rpg, i plan to have an effects system, ex. an attack inflicting the opponent with burn, poison, freeze, etc. etc.
what would you say is the most efficient way to do this?
the player has a class, so you can add attributes if necessary. here is the class code (done by me)
as you can see, i have effects in the attack setting, but how should i go about adding it in an actual battle?
going through a bunch of if statements (if attack[2] =="Burned", if attack[2] == "Freezed", etc. etc.)
making a dict to match effect name with effects?
thank you in advance! I have to go now, so i'll respond tmrw morning!
@Jonathan Eshetu
–
if they cause the same effect then you could use if attack[2] in ....
if the effects are different then a dict sounds like a good idea.
@Num Ic
–
You're obviously more advanced at this then me, lol
so this is all being done on repl.it (remember that), so if you have an account, I can invite you to the repl ;)
however, i'm not the owner, so i'll have to wait until the owner gets online.
@Num Ic
–
it's not only rpg, you're just advanced in coding in general.
so would you like to join? i'd invite you some time tmrw, and we could really use the help lol. i understand if you say no ;-)
@Jonathan Eshetu
–
oh, i love to join. its just that seeing you young guys doing all this cool stuff makes me feel i miss a lot that i should have done when i was younger.
i ll try to find some energy to create an repl acc.
@Jonathan Eshetu
–
ty for checking. its not late. i was just curious bcs they updated the wording already some days ago, so i was wandering if there was more then just marking it as resolved. ty again
Yeah, I set it to .split(" + "), .split(" - "), and .split(" = "), so that's why it does that. If I remove the spaces, it might count them as numbers...
@Paul Romero Bello sry for the deleted msg, i tried to get your mention id, to "invite" you to this note.
the 2 links in this note are very helpful. i found some more too. and i can help whenever you are ready to try some latex.
additional: an idea to post a solution without pictures would be:
51234
23451
12345
34512
45123
lol, the numbers where just cycling. i have not recognized that before.
@Num Ic
–
Yeah, I realized how it works by myself. Now, I am taking notes from your post. I hope to post a solution for tomorrows problem, if I get it right, of course!!!
@Jonathan Eshetu
–
very nice. ty for that idea.
i don't mind the pings. i enjoy the interaction with you two. @Paul Romero Bello please feel free to try it too.
if you don't want to get pings from this note, then you can click "unsubscribe", but i'm not sure what kind of notifications you will still get then.
maybe you want to use this. just an alternative to using percy's ;-)
i'm still curious. i assume a mac has a screenshot function?
else you might have something similar like snip&sketch:
when the "print" button is pressed, it offers some screen capture options.
i don't have a mac, but the web says shift-command-3 create a screenshot.
u said u use a pc-keyboard, so i assume the command key is different from the funktion key. is it?
Thanks for the link. The way I interpreted it was this: take any group of two students, there are 60/2=30 and there are 60 x 3 = 180 possible answers of which 60 x 2 =120 correct whatever the distribution. 60 answers are either all right, all wrong, or a combination of right and wrong. Person A could get Q1 right, and person B could get Q2 right. That's 2 questions right between 2 students. Or, A and B both got Q1 right but C and D got Q2 right. Or, if person A got Q1 right, B got Q2 right, and C got Q3 right, then D could have gotten Q1 or Q2 right or even Q3. I'm probably making too much out of this.
i just copy the statement, so it's more easy to compare.
"During an examination, 60 students had to answer 3 questions. After the examination, it's shown that for any two students, there is always at least 1 question which both students could solve."
it deprnds on the original wording but 60/2 is dividing the 60 students into groups of 2.
but any two students would be 60*59/2 (combinatorics: pick 2 out of 60).
so this is much more than 30.
regarding the 1 question that both could solve. the wording indicates that both had the same question correct.
and as i said: the total number of questions is not stated. it could be the 3 same questions for all 60 students, but it could be more depending on the conditions of the problem.
the problem like you described it sounds more like:
60 students are divided into groups of 2.
each group had to answer 3 questions. both students answered individually.
every student gave at least one correct answer.
i was used to program in basic and c, but python is very nice.
i'm still on my way to understand how to use python-goodies like range and permutation.
but please feel free to ask questions regarding coding. it would be a pleasure for me to help you.
Thank you. Long ago (30 years) I used Fortran, Watfive, Pascal and Pascal took the lead. I got into a lot of Finite Element modeling with programming but quickly canned programs came on the scene in the form of software. So, I drifted away from programming and relied on software. But I'm impressed with the flexibility Python offers and want to learn it. Been doing a little here and there but get lost in the goodies (permutations and other libraries). I'll be sure to take you up on that with questions as they arise. Thanks again!
@A Former Brilliant Member
–
nice i used pascal too. i have seen fortran but never used it. is/was it fun to work with it?
i dont know watfive. i will search that.
you said you'r a bridge engineer. that sounds very interesting.
@Num Ic
–
Watfiv had some additional features over Fortran but as Fortran indicates "formula translation" was its main feature. With advent of Pascal working with arrays took on new meaning. Bridges are fun because they encompass so many aspects of civil engineering, structural, hydraulic, highway, geotechnical and it all has to be designed around those criteria. Kind of like a puzzle with constraints.
@A Former Brilliant Member
–
i could find some fortran code samples. i'm glad that i could mainly understand them.
fortran whatF iv was harder to find, they looked a bit like assembler code.
hm i assume 180 is the maximum if all student get different questions.
(there might be more but that should be mentioned like: ... had to answer 3 questions out of a set of questions.)
my first assumption was: all students get the same 3 questions.
i still assume this is the idea. but i have no idea what the question behind that setting is.
is this the original wording or is it just a draft for a challenge that you prepare?
It's the actual wording of a problem in the challenges community I believe under logic. The writer intended for the groups of two to get the same question right. But I thought there could be different interpretations.
"there is always at least 1 question which both students could solve."
--> implies that each student had at least 1 question solved.
--> if even one of them only scored 1/3, then that particular question must be solved by 59 others to make this claim true. We can see this in just a group of three, let ABC be the students and 123 the questions. Say q1 is the easiest one, so average students A and B could only manage that one. But even when brilliant C solved the other difficult two, but made careless mistake / ran out of time on q1, the claim will be invalid (A1, B1, C23).
--> if there are no 'easy' question which is scored by ALL the students, then all 60 must have solved AT LEAST 2 questions each.
Thank you, Joe, but that compliment is too high for me. I am still struggling when confronted with questions under category group theory. Too much lines and nodes than I can handle. And sorry I didn't think deeper than taking it as the 60 are just the usual class of hs students answering the same 3 questions. Perhaps the assumptions brought along from Three Questions problem we just had around Xmas.
@Saya Suka
–
I liked that problem around Xmas but then there was more information to give a certain exactness. My approach is always to flesh out the knowns so when confronted with abstractions I'm in unchartered territory.
regarding 'beating a dead horse': hint: each char is coded as 2 digit number.
meaning: to waste effort on something when there is no chance of succeeding.
(beat a dead horse)
(i assume he wants to say that there is no benefit in discussing the different ways of solving the challenges. - in my opinion the expression does not fit here very well.)
in old times some riders did beat a horse to make it run faster, but if the horse is already done then this will have no effect.
Expression means "We've discussed this so much and in so many ways but aren't making any progress." I value different approaches and don't understand why people think they have the ultimate solution. It's like asking, "who's better - the republican or democratic nominee? Obviously it depends on what you value. So, I'm advocating that all approaches that yield the correct answer are valuable. The lengthy one that experts find redundant appeals to the person who lacks that knowledge to solve. The programmer who has solved many cryptograms and is honing his programming skills is saving time but providing knowledge to those who don't know programming. Etc.
@A Former Brilliant Member
–
good point. i assumed by 'beating a dead horse' you meant that that discussion has no positive effect.
my hope is that the discussion helps the critic to understand that there is a value in presenting different solutions (even coded ;-).
Thanks, num IC! For the horse proverbs explanation and the hint, but still I'm getting no progress. I don't understand 2 parts there, one is the many 7 there (though your reply had an almost balanced quantity of 6 & 7), and the other is why there are abcd included there too.
@Jason Gomez
–
Thank you, Jason & num! Now that I got the one to one exchange, I have four more questions.
1) why does space represented by a number far away (or it's just up to the encoder)?
2) is it usual for the alphabet not jumbled up in true encryption, like with this we have too many 7s & 6s, but it could be made 0 ~ 9 in balance somehow?
3) spy action movies always mentioned something like key, but is that the word the encoder will spell first in their encryption?
4) the length of the blocks, can we make it in odd length?
Sorry if these are stupid questions, but I don't know where to find the answers online. Sometimes what's provided isn't answering all my queries. Thanks for the hexadecimals, both of you!
@Saya Suka
–
I think the space was up to the encoder or maybe has something to do with ASCII values but not required
In true encryption, alphabets are completely jumbled and the position of the alphabet matters and what lies next to the alphabet matters… u get the point I think, but Broekhuis had to make one which was crackable
The key is what is required to decrypt the sequence, without it becomes too hard to decrypt, in this example my post down below has a key which is the dictionary and the key can be sent with the message, but only knowing how to use the key can decrypt the message
U can do anything in encryption until it is possible to decrypt to a single message back again, if that can’t happen, that’s not an encryption, that’s data loss scheme
@Jason Gomez
–
True cryptography, as opposed crypto-arithmetic would be a good question for Brilliant to post. You had asked for a crytoarimthym that would be hard to solve without a computer and I came up with this: ABCDE x FGH = HCFIIAJ. What do you think?
@A Former Brilliant Member
–
I will reply after three hours cause I have something important to do now, but it seems good since I am unable to get any info at first glance
@A Former Brilliant Member
–
Ok I have been trying to solve this monster but to no avail, I am not even able to eliminate enough to get the idea of assuming and checking for contradictions, this is truly requires a computer @num IC did u try this
@Saya Suka
–
I used to use ternary for encryption when I was small A-001 B-002 C-010… Z-222 (used to confuse my friends a lot) so hexadecimal isn’t the only thing u can use for encryption but it’s nice to have the decrypted data and encrypted data to have the same size, mine was way too inefficient in that way
@Saya Suka
–
yeah there are different ways to encrypt something.
the sample was easy bcs he said: here is the text and this is the encryption.
but without the original text or other hints it can be very difficult to decode something.
@Num Ic
–
There was a course on this exact topic in brilliant, premium though, they had a frequency chart of how frequently the alphabets were used ( that’s how I came to my conclusion for e and a, although the a was wrong because I didn’t expect spaces but 7a was actually my next target ) so if I encrypt a message large enough, using that table u can practically decode it if there is just a one-one encryption or at least find out most of the words and with some guessing find the rest, but I was unable to find the table no matter how much I tried otherwise I would have shared it.
@Num Ic
–
Right...like how about you take a phrase in English, translate it to Persian in English, then do a simple Caesar's Shift (English alphabet)? Even that would be difficult.
jason gave a good hint: i'm used to treat hexadecimals as numbers.
(so i refer to a, b, c, d, e, f as numbers too)
with this you can decode every two "numbers" to represent a char.
so "beating a dead horse" = 79767a67 726d7420 7a207776 7a772073 6c696876
decrypts by: 79='b', 76='e', 7a='a', ...
@Andrew Last i have never posted a zip-file on brilliant, but would it be ok for you to post a link to your python code for the Decanting Decision animation here?
or maybe the code is short enough, so you could just put it here as a normal post?
(i just downloaded manim, so your code would be a good introduction to understand that tool.)
it's fully ok if you don't want to post it.
@Zakaria Sabbagh i propose to discuss programming items here, to not disturb the challenge posts.
can you tell me what kind of program you already have coded? eg: do you know how to add two variables and print the result?
I am a new member in Brillant.org I joined two days ago for the first time and was amazed to see programming solve complex equations and wanted to try to learn, but I feel drown into a maze and I do not know where to start !
In fact, I still did not get the first course in programming yet but I have the desire to learn. I am specifically interested in programming that solves mathematical equations
@Num Ic
–
I have no initial experience or knowledge of any programming before.
I didn't know there is anything called coding environment here, i only open when you share for me, in fact I spent all yesterday searching specifically for these coding side, where I can print codes, on the internet! and I couldn't understand why it was so difficult to get it as if it were a miracle!!
And after a long suffering I found these two links:
Then I tried to solve a new equation by copying and modifying from some answers here that used python. I finally succeeded in writing correctly the new equation code but I did not get result and it seems that the program I use is not very developed and it said : time limit exceed!
Unfortunately, I do not know how to add and code two variables and I want to learn from zero
@A Former Brilliant Member
–
Hi Zakaria, I think I have a couple websites that might help. Consider checking these out:
https://inventwithpython.com/ (This website has several programming books, I recommend "Invent Your Own Computer Games with Python, 4th Edition", not only for games but because it generally teaches you)
https://edabit.com/challenges/python3 (This website has numerous different challenges, ranging from very easy to expert)
From there, I recommend you just start programming! 99% of any questions you have have been asked before online, so just search it up! This is more or less how I started programming.
@A Former Brilliant Member
–
Jonathan gave some good advice.
please feel free to ask if you have more questions or if we can help with some programming issues.
even if it sounds strange: it's a good idea to start with a simple "Hello World" program,
this makes sure the coding environment and the output works.
a disadvantage of the brilliant coding environment is that it cannot handle the input function (so at each run, the input has to be set manually. but i use it mainly to create solutions, so no input is required) and the brilliant environment is very slow compared to other coding environments.
but it's nice, because it is already here ;-)
Yes you are right and nothing strange if I start with "Hello world", i am not just interested in learning some codes and how to enter it, but I tend for Intense understanding and i need understand how these codes and programming fundamentally work
i have read the free introduction of brillant python programming courses and i find it great, now i would like to go more deeper i think i want to read the "Python Crash Course: A Hands-On, Project-Based Introduction to Programming"
by Eric Matthes which I found in the link that Jonathan recommend
I don't face problems till now, i am still in the beginning and before diving but i will provide with your pinwheels so i am not afraid of drowning! I really feel grateful for your interest and your encouragement
@Num Ic
–
I do not understand well what you mean but I use brillant coding environment, I applied many codes that i learned outside, specifically related turtle library, and everything work fine
But if you mean my PC python program so I do not have PC and it does not matter
@A Former Brilliant Member
–
ok i'm glad to hear that. as i said: the brilliant environment has some limitations and is slow. so if you experience some performance issues, just ask here and we can propose some other online coding environments.
@Num Ic
–
Yes, I think I understand now what you are referring to, but I found that I still could dispense some initial necessary codes in brillant coding env. which is required in some others env. outside, I do not know maybe they are always developing it!
I am working on a small python program that has not finished yet, I reach there..
But i have thousands of outputs and look separated like this:
27
9
36
etc.
how can I combine the outputs in one tuple or one list to continue working on the variable y?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import random
for n in range(0,10**10):
string_n = str(n)
shuffle_string = ''.join(random.sample(string_n, len(string_n)))
united_string = "".join(shuffle_string)
n1 = int(united_string)
x = n - n1
y = sum(map(int, str(x).lstrip('-')))
print(y)
ok. what shall this code do?
ty for using 3 of these ` before and after your code :-)
does that out-variable solve your request?
1
2
3
4
5
6
7
8
9
10
11
12
import random
out=[]
for n in range(0,10**1):
string_n = str(n)
shuffle_string = ''.join(random.sample(string_n, len(string_n)))
united_string = "".join(shuffle_string)
n1 = int(united_string)
x = n - n1
y = sum(map(int, str(x).lstrip('-')))
print(y)
out.append(y)
print(out)
I am trying to prove a mathematical issue which is if you take whatever number and subtract it from another number composed of same digits the result is always multiple of 9 e. g.:
@Num Ic
–
Sorry for being late, I was testing your code..
You are shrewd 😃 and I did not think the answer was so simple, I should have ask from before 🙃, thank you very much
And here is the sequel:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import random
out=[]
for n in range(0,10**10):
string_n = str(n)
shuffle_string = ''.join(random.sample(string_n, len(string_n)))
united_string = "".join(shuffle_string)
n1 = int(united_string)
x = n - n1
y = sum(map(int, str(x).lstrip('-')))
out.append(y)
import functools as f
A = out
g = lambda a,b:a if b==0 else g(b,a%b)
common_factor = f.reduce(lambda x,y:g(x,y),A)
print(common_factor)
@Jason Gomez
–
Do you know a way to invert a dictionary directly, without loops and storing in another variable ( I really need to learn about dicts a lot ), I had to print out the inverted dictionary and copy it back it into the code
@Jason Gomez
–
i don't thing so, but when i did a python course, i stopped at dictionaries bcs i had no idea how to use them.
but it should be easy with a loop. why don't you want to use a loop?
@Num Ic
–
It’s possible I know but python always comes up with these shortcuts, I didn’t want to use a loop because I wanted everyone to see the contents of the dictionary easily ( includes me I will be using this or something similar on a cryptogram daily challenge soon )
@Num Ic
–
"I completed this solution using a 200 line efficient python program which I was too lazy to write. Program will be posted some time in the future."
@Jason Gomez
–
ok. if your chief aim will be to get as many downvotes as possible, then it seems that your solution has to be one of the first that are posted. since they get the most downvotes (independent from the content)
@Jason Gomez
–
i found an easy code to create an inverted dict: ivd = {v: k for k, v in dec.items()}
dec={"7a":"a","79":"b","78":"c","77":"d","76":"e","75":"f","74":"g","73":"h","72":"i","71":"j","70":"k","6f":"l","6e":"m","6d":"n","6c":"o","6b":"p","6a":"q","69":"r","68":"s","67":"t","66":"u","65":"v","64":"w","63":"x","62":"y","61":"z","20":" "}
ivd = {v: k for k, v in dec.items()}
print(ivd)
but you have to be careful if two keys refer to the same value.
Oh this works for dictionaries as well I thought it did only for lists, well it’s easy to see the contents are being reversed/inverted so I will use it, thanks
@Num Ic
–
@Saya Suka @num IC Can you guys solve this? I posted this but took it down b/c nobody got it right. I want to be sure I'm correct and you are both good at probability problems. It could be as simple as the wording is confusing.
Family, “A”, goes to a restaurant on any given night 2 times every week at 5 or 6PM. Family, “B”, goes to the same restaurant 3 times every week between the hours of 5, 6, or 7PM. What is the chance they will meet during a specific 1 hour period of time? What is the chance they will meet during any one hour window of time? In these cases each family stays for one hour. What is the chance they will meet during any consecutive 2 hour period of time if they stay for the two hours? List you answer as the sum of these probabilities in percent to the nearest 1/100th.
@A Former Brilliant Member
–
I think you should mention whether they just show their heads in the restaurant or they stay for one hour or stay for two hour
@Jason Gomez
–
I think your idea is good. How about rephrasing to "during a specific one hour window of time" and "during any one hour window of time" and "during any consecutive 2 hour window of time"?
@Jason Gomez
–
Yes, that's what I meant but need to clarify by saying they stay for one hour. So, the latest family A could go is 6PM in order to stay an hour. And family B must arrive at 7PM to stay an hour at the latest. Thanks!
@A Former Brilliant Member
–
I think Jason is talking about how long a time the families spend in that restaurant, the width of window of opportunity between them? And I think that you meant for "specific XX hour" to be that time (total time for getting seated + orders taken + orders received + eat + pay), but it wasn't very clear to some. I actually saved this question, because I'm never good with this and planned to get it right for the first time but have to reread similar solutions first. The others are mostly about police catching a criminal or two spies / informers meeting at the park or something.
@Saya Suka
–
I edited above. Did you see that version after Jason's comments? They are stay for a one hour period and the specific case is a conditional probability.
@A Former Brilliant Member
–
I think you have to mention which specific one hour period you are talking about
5:00-6:00 has less probability of A coming but 5:30 to 6:30 has a higher chance(A has to be in this time period for 30 mins atleast if he comes on that day)
@Jason Gomez
–
Our answers are close, within 1% both cases. Mine is higher in the 1st case, and lower in the 2nd. But I don't want to provide methods until @num IC and @Saya Suka have a chance to solve, or I may influence their thinking. And I could be wrong.
@A Former Brilliant Member
–
i would start by calculating the chance that they are on the same day in the restaurant.
for the chance that they pic all different(!) days i got:
2/7 * 1/6 = 1/21, so the chance that they have at least one day in common is 20/21,
which seems to be quite high.
anyway i assume we have to calculate the chance that they have 2 days in common too.
but i struggle to understand this 'they meet during a specific 1 hour'.
in my understanding this means they are at the location at the exact same time.
but what is the granularity?
do they either arrive at 5 and leave exactly at 6 or arrive at 6 and leave at 7?
what happens if they arrive at 5:15? do they leave at 6:15?
does that mean the other family has to arrive at 5:15 too bcs all stay for exactly one hour?
what happens if the granularity is one second? or even smaller?
a finer granularity would decrease the chances.
if the granularity is 1 minute and the stay-time is exactly one hour,
then (if both are on the same day at the restaurant) both can arrive at
5:00, 5:01 ..., 5:59 or 6:00,
so the chance that they are in the restaurant at the exaxt same hour would be 1/61.
@Num Ic
–
this may be a bit dumb, but assuming that they arrive only at 5/6/7 and stay for exactly one hour..I got 6/147?
If you take a random day, the chances that family A is there is 2/7 and family B is there is 3/7.
multiply them to get 6/49.
from there, the chances that they have the same time is...
A has 2 possible times.
B has 3 possible times.
2*3 = 6, only 2 times actually work (5 to 5, 6 to 6).
2/6 = 1/3.
multiply the possibility of them being on the same day and them being on the same time (6/49 * 1/3) and I got 6/147
@Jonathan Eshetu
–
i agree on that 1/3 part if both have to arrive at 5 or 6 to meet.
i have to re-think that 2/7 and 3/7 part (i hope you are right bcs that would be easy to calculate), but i assume it misses the part when they have two days in common.
@Num Ic
–
The way I was thinking is that we don't know which days they will go. It could be M&T or M&TH or Th&F. It's not like there are 2 red balls and 5 blue balls so probability red is 2/7. There are many ways for 2 days to occur. That's why I though 2C7=21 and 3C7=35. When it comes to the hour, 1C3=3 or 1/3 and 1C2=2 or 1/2. Not saying I'm right. More minds are better than 1. The other thing for the specific times a) and c), Family A arrives, so it's a conditional probability of Family B meeting Family A given that Family A is there (like your holding a card, what is the chance of getting another card of the same suit.
@Num Ic
–
I started off trying to understand Zakaria worked numbers with his many weeks considering 0, 1 and 2 common days. The ratio I got was 2 : 4 : 1, so the 6 from (2/7)(3/7) = 6/49 came from 0(2) + 1(4) + 2(1) = 6, and nothing is left behind.
@Jason Gomez
–
But that was just a silly mistake, and btw don’t you think reading the word null hypothesis will make people want to read the explanations, I never had learned of this before the new statistics chapter came out, so this problem should rated higher
@Num Ic
–
I think I won’t change it as I just remembered how I used to struggle with the notation change two years ago, which stopped me from learning a lot of maths
@Jonathan Eshetu
–
You could get up at 6 and do(If you like putting explanations up the glorious time is between one and two hours after the challenge has been posted, anytime before and you will be hit with the confused, anytime after your solution won’t be seen unless you are David Vreken, Chew-Seong Cheong or other respected people)
@Jason Gomez
–
It's funny how you've perfectly memorized the norms of Brilliant's daily problem posting. Don't forget Percy Jackson, Frisk something-or-other, and Siddarth something-or-other. And I can barely wake up at 7:45 without a headache, so I don't think that plan will work, LOL
@Num Ic
–
Granularity sounds like food, but I believe you're talking about the smallest time division that's taken into account. I've only seen the solutions using hour, half or quarter blocks of time, so I guess they use one minute granularity? For the day part, I would guess p(same day) = 1 - (1 - 2/7)(1 - 3/7) = 1 - (5/7)(4/7) = 29/49. I'll go look for the similar ones later.
@Jason Gomez
–
Thanks Jason. I truly missed that, must have been that was my assumption when I read Joe's original question there and didn't read them again here. So I take it that one family could have passed the other by on the same welcome doormat outside & that doesn't count as a meeting, right? Then the time slots should be 2 & 3 blocks for each family (5.00 ~ 6.59 & 5.00 ~ 7.59). Thank you again for this, Jason!
@A Former Brilliant Member
–
Hi,
I see there is not enough information to solve the problem and the basis here confuses the concept of probability, average and also relativity!
The first question raises two dilemmas:
First dilemma is based on days and regardless of timing and related to the total number of times to go to the restaurant and from whose point of view, family A or family B or me? e.g. in 35 weeks (family B possible combinations) they meet 30 times (20 times one meeting a week and 5 times two meetings a week) but the total number of visits is 70, 105 and 175 respectively from the family A, B and my point of view!!
Second dilemma is related to timing i mean the question by itself: what is the chance they will meet during a specific 1 hour period of time?!!! but this period should be fixed and precised, and there are four different cases for timing:
5 to 6
between 5~6 to 6~7
6 to 7
between 6~7 to 7~8
And there is different probabilities: 1/1 for second case and 1/2 for other cases and a confusion with the average concept happen here!
And the complications increase for the second and third questions...
@A Former Brilliant Member
–
Hi, Family A b/c they have the shortest window of time. 2 times on average per week or 7 days/ 3 times on average per week or 7 days. Not 35 weeks, the number of combinations if you averaged 3 times per week would result in 35 combinations or ways that 3 days may occur, thus, 3/35 and 2/21. Relativity, the clock on the wall is the measure of time - it's objective - standard. Their watches are synched or they have GPS on their phones. They meet, having watches/phones in hand they agree on the time. They spend an hour of time. If Family A is there at 5PM they are also there on a specific day. P=1. What is the probability that Family B will visit the restaurant given that Family A is there. If Family B were to go there at 7PM, there would be no chance of meeting Family A because Family A leaves at 7PM. One hour of time is reasonable to order food, eat, drink coffee. The longer you stay, the greater the chances you will meet. Your English is hard to understand, seems you put very little thought into the matter. I can hardly take you seriously given your proposal.
@A Former Brilliant Member
–
That's a harsh criticism, anyway I do not claim genius, but I want to tell you that I enumerate one by one, all combinations for both families then I check all common possibilities, also one by one, and the above notes are strictly based on this examination
Maybe you are right, I overreacted in the forms but in context I still see that what I mentioned above are real obstacles
Sorry for my language, this is the best I can speak
@A Former Brilliant Member
–
Don't take it personally. There is a 25% chance we will understand each other anyway even if your English was good. Based on what you have written in your response the 1st time, I find it hard to believe you even grasp what the problem is about. Your talking about weeks of time. The data provided was for a small increment of time of one week. Your introducing more error by extrapolating months ahead. While it's true they meet 70 times in 35 weeks, that doesn't say on which days they meet. If I meet 2 times every 4 days, that does not say on which days I meet. So using combinations takes into account all the ways you can meet by chance - it introduces variability. Two consecutive days MT, TW, WTH, M-W, M-TH, T-TH, one day apart, etc. Furthermore, the problem was brought up to collaborate with others because it is a confusing problem - the English required to state the problem needs to be clear and precise. As it is it is rough. Thus, the collaboration. So, if you want to collaborate, happy to hear your opinion.
Yet, I am only dealing with the first question and should be solved in the help of the following points :
the chance they go to the restaurant in same days and regardless the timing per hours
In the next stage , the chance they will meet together in the time by hours
First of all, Family A has 7C2 = 21 combinations and family B has 7C3 = 35. For the first point, whatever are the 2 days family A go to the restaurant, there are 5 chances they meet family B in both days and 20 chances they meet only one day. e.g. family A go on (W, F) they meet family B both days as following: (M, W, F), (T, W, F), (W, TH, F), (W, F, SA), (W, F, SU) and only one day as following: (M, TU, W), (M, TU, F), (M, W, TH), (M, W, SA), (M, W, SU), (M, TH, F), (M, F, SA), (M, F, SU), (TU, W, TH), (TU, W, SA), (TU, W, SU), (TU, TH, F), (TU, F, SA), (TU, F, SU), (W, TH, SA), (W, TH, SU), (W, SA, SU), (TH, F, SA), (TH, F, SU), (F, SA, SU), however in the first 5 cases they meets in both days and it should be calculated as 10 chances because when the second point above is discussed, the timing by hours depends on every day and they can not meet or they meet one time or two times, and the total is 10+20=30 chances. the penultimate note, whatever family A combination is, such as (M, SA) or (TU, TH) etc. there are always 30 chances. now is the probability 30/42 or 30/70 or 30/105 or what??? I have no answer and i need to finish this issue before moving to the second point
@A Former Brilliant Member
–
I do not know exactly what you have done, as you have not clearly explained your procedure, but I assume you have not used the information that a week has 7 days
@A Former Brilliant Member
–
If I am dealt a King of spades, what is the chance I will be dealt another King from the deck of cards? P(K)=(1)(3/51). In order for them to meet, one family has to be there. If I start with Family A, Family B could come at 7PM and they would never meet. So, if Family A comes 1st, P=(1)(1/3)(3/35) and the chance they never meet is factored in. Provided Family B is there at 5-7, then P=(1)(1/2)(2/21)=1/21. So, it's between 1/35 and 1/21.
@A Former Brilliant Member
–
regarding the weeks: you are right: if we check 1000 weeks then the chance is 1000 times the chance of one week.
so the question is just about the chance to meet in one week, not in x weeks.
regarding the time: i had the same question.
i learned that the idea is that they can only arrive at 5:00, 6:00 or 7:00,
(they cannot arrive at 5:15)
@Num Ic
–
The following was mentioned in the problem: "In these cases each family stays for one hour" and I guess it relates to the first and second questions and given a third question
@A Former Brilliant Member
–
Probabilities don’t change no matter whose point of view you take, it’s a basic approach always taken in calculating probability(classically speaking)
@A Former Brilliant Member
–
For the specific one hour period of time, since the granularity is one hour and it’s obvious that A can’t come after 7, he means that the specific one hour period of time is 5-6 or 6-7 , and they both have equal probabilities, so need to consider the average
@Jason Gomez
–
And how you dealt with the word "between" here: "between the hours of 5, 6, or 7PM." in difference of the previous expression "at 5 or 6PM"? for me, it goes without saying that there is reason to use two different expressions
@Jason Gomez
–
Posted it because I did want to see if there was any mistake on my part (I waited for a whole day for Saya Suka to post an explanation but she (if the gender is wrong, I am sorry, I am really bad at figuring out gender from names most of the time) didn’t post one, so if this influenced her thinking I am sorry.
@A Former Brilliant Member
–
I use the daily challenge explanation posting area to make links of my pictures, then copy and paste them whenever required, it’s the third button from the left, but then how do you paste pictures on the explanations you make??
@Jason Gomez
–
Let me tell you, Mathcad is powerful. Does matrices, solve-blocks, roots, calculus, routine algebraic manipulations, programming and much more. My first boss used it in a bridge consulting firm and instructed me to learn it back in 1987. We were small, but competed with the big boys. Back then it was prime for making templates which could later be used in design. Initially, you spent time making the template, but on later bridges it became efficient and you only had to enter variables. There is a version that is freeware:
https://en.smath.com/view/SMathStudio/summary
Doesn't have the level of support but has examples. It's tailored after Mathcad...probably written by one of their software engineers. So, I could help you if you have any questions about use. Or, if you buy Mathcad, you will get plenty of clear examples on how to use.
@A Former Brilliant Member
–
Could you solve the six equations posted in my discussion here I’ll put the equations here also but there isn’t much space so it might not come fully
@Jason Gomez
–
You'll have to create a vector for p values and keep track of indexing, for example p(0,6)=(1, 2, 3, 4, 5, 6) and
p(6,0)= (1)
(2)
(3)
(4)
(5)
(6)
@A Former Brilliant Member
–
Could you solve it and give as I do not know how to use mathcad, and this will probably be the only time when I would I use it(I am not an engineer yet and seeing how you use it astounds me, knowing how many nails to use was not calculable I thought, I have never done such computational work), so I am not very eager to learn it as I think I am fine with what tools I have (python does most of my computation work which isn’t much)
@Jason Gomez
–
Sure, I'll look into it later. Because it's a WYSIWYG program, it's much easier to use than Python, or excel b/c the language of math is in front of you. You invest a little time learning, but you can capitalize on that investment later by saving time. If you're a student they have a student version for like $500.
@Num Ic
–
It's been one of those weeks for me. Right now time is an issue. If you take a look at the Mathcad website and run through some examples, you can see quickly its capabilities. It's like programming but you see what you've done - the trade off is learning how to speak in Mathcad.
@A Former Brilliant Member
–
ty for the mathcad link. i will try to find some time time to check it.
regarding posting pics: whenever u want to do it: just ask when u want us to give some more explanations.
@A Former Brilliant Member
–
Hi, Joe! By this "What is the chance they will meet during a specific 1 hour period of time", you mean for "what is the total probability for the two families to be 'dining together' in any given week?" or "what is the probability that a mutual acquaintance will meet both families on day X at time Y at the restaurant?"? When I reread the word specific, I have a feeling it could be the second, so I guess I'll just ask for confirmation.
@Saya Suka
–
I see your point...I guess I was thinking conditionally for the 1st part a). Given event A or B, what is the P(A/B) or P(B/A). The 2nd part b) is supposed to take into consideration the total chance. Looking forward to see the conclusions you draw from this.
@A Former Brilliant Member
–
I guess you should take the liberty to solve in a way that you can, and the question should be reframed to answer what is determinable.
@A Former Brilliant Member
–
This is what my Venn told me :
1) we have P(A dining there) = 2/7
2) we also have P(B dining there) = 3/7
P(both families dining there on the same day) = (2/7)(3/7) = 6/49
So, 49 days is 7 weeks, and in that time A would have been there twice a week for a total of 14 times, while B with 7 weeks x thrice a week = 21 times.
Total days in 7 weeks that the restaurant have at least one of the families there
= (14 - 6) + 6 + (21 - 6)
= 8 + 6 + 15
= 29
Days that neither went = 49 - 29 = 20
@Saya Suka
–
I didn't get the numbers straight away. Zakaria mentioned the many weeks he considered so I tried to understand what did he calculate, and from where did the numbers came. I found that his numbers only account for same days probability and the timing wasn't accounted in there yet. So I went with the different ways for the day's could be chosen by both families, but in the end, after all the simplification has been done, it turned out exactly like how it'd happen if I just multiplied the original 2/7 & 3/7 together. It kind of makes sense if you think that even when A is already there, the day could or not be the day B will join them too. It could happen with 3/7 probability or not with 4/7 probability.
@Saya Suka
–
For timing family A has 2 1-hour blocks and family B with 3.
For a) & b), the divisions are depicted as below :
A ==> 1/2 + 1/2 + 0
B ==> 1/3 + 1/3 + 1/3
For c), the divisions are depicted as below :
A ==> 1 + 0
B ==> 1/2 + 1/2
I took your a) as that mutual acquaintance situations, so it would be the same 1/49 for both the first and second hour, p(at 5) = p(at 6) = 1/49 but
p(at 7) = p(A at 7) x p(B at 7)
= (2/7) x (0) x (3/7) x (1/3) = 0
For c), p(spending 2 hours together)
= (2/7) x (1) x (3/7) x (1/2) = 3/49
@A Former Brilliant Member
–
With the above, I just rationalize that they can only meet if both went the same day and the same time slot. P(dining together)
= P(both choose same day) x P(both choose same time slot)
= (6/49)(2/6) = 2/49
@Saya Suka
–
That makes sense too me. It has to be between 1/21 and 1/35 if you assumed conditionally one family was already there when the other popped in by chance.
@Saya Suka
–
Going to put this up, but need you guys to weigh in:
Family "A" dines at a restaurant two times for one hour between the times of 5-7PM. Family "B" dines at the same restaurant three times a week for one hour between the times of 5-8PM. a) If Family "A" goes to the restaurant at 5PM on Wednesday, what is the probability they will meet Family "B"? b) What is the probability that Family "A" and Family "B" will meet at any one hour window of time on any given day? Please provide your answer as the sum of parts a) and b) to the nearest 1/1000th.
Here's what I got:
a) Pa=1, Pb=(15/35)(1/3), Pa*Pb=(1)(3/7)(1/3)=1/7
b) P=(1/2)(6/21)(15/35)(1/3)=1/49
@Num Ic
–
Might make this more challenging and ask for total days there. I get 49 days which is 7 weeks. Family A is there 2 x 7=14 days and Family B is there 3 x 7=21 days. They are in there 6 times on same day. They miss each other 23 days (21+14-6-6). Total days one or both Families are there = 29 (23+6). Days they meet at certain time of 1 hour = 1. Total days neither there 20 (49-29).
@Chelsea Saunders hello, i assume you posted a video-solution to the yesterdays daily problem (Double the Fun).
i just wanted you to be aware that the video shows the tabs of your browser.
nothing to worry about this time (the sherlock video seems to be interesting :-)
but please be careful to avoid showing some personal data in future videos.
@Num Ic
–
it's a thing on windows 10. i found it in the video in one of the other tabs. press windows key + G and it brings up an app to record screen and your voice.
@Jason Gomez FYI - you can get a student license for Mathcad for $60 from PTC Web Store for one year. And Maple Soft has a similar product student license for $99 for a year. Both require Student ID verification. If I weren't so used to Mathcad I'd probably switch to Maple Soft. Worth looking into.
It means de-arrangement and this one exactly means the number of ways to de-arrange 24 objects such that none of them remain in their original position, check this wiki out
@Jason Gomez the algorithm by itself cannot give a discount, but i assume if you ask the staff they might be able to check that for you.
you could tell them that your premium abo ended. and if there currently is a discount available for you.
if they don't make an offer, you could also ask if you should wait until the next season offer (easter time is close).
sorry i try to avoid giving advices without beeing asked for. please tell me if this advice is unwanted, then i'll avoid that in the future.
No I really want advice, I don’t want to sound like some cheapskate not wanting to pay more, when ofc this website is worth more than its weight in gold, so it’s really hard for me to ask as well, free advice given is always accepted by me especially in this situation when it’s quite awkward
I didn’t know there were season offers, I was pondering on my option of not subscribing because I may go (mostly infact) inactive after May
i saw some offers but i don't really know if there are season offers.
if you rich then i apprechiate if you support brilliant even when you are inactive.
i'm poor so use only the free access, and thb: this already has a lot of content.
so if u are not rich, then why not pause the sub while u are not active.
@Num Ic
–
I am sort of the middle guy, who can afford this but still would mind his expenses. As said I might stop in May but may restart after September/October depending on the course I have chosen for college, so it may become very useful that time.
Easy Math Editor
This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.
When posting on Brilliant:
*italics*
or_italics_
**bold**
or__bold__
paragraph 1
paragraph 2
[example link](https://brilliant.org)
> This is a quote
\(
...\)
or\[
...\]
to ensure proper formatting.2 \times 3
2^{34}
a_{i-1}
\frac{2}{3}
\sqrt{2}
\sum_{i=1}^3
\sin \theta
\boxed{123}
Comments
i found some interesting TedEx video about coding: Episode10. i found the last episode first, but i assume it's better to watch them from the start ;-) think like a coder
Log in to reply
ah, that, I've already watched the whole series before ;)
Nice & helpful discussion @num IC
;-) ty. i didnt meant to make an official post. by accident i pressed save instead of edit.
thanks to u i know how to use notes. since then i use notes to test latex before i post it.
before i discovered this, my latex posts had a lot of post-edit-post-edit-post chains.
Log in to reply
I have deleted the chatbot discussion .Is there any problem or it is fine?
Log in to reply
Your welcome.
□⊕∇⊘O◊Δ⊖⊗⊙ ∗∘△ΘΞΦΩ
□⊕∇⊘O◊Δ⊖⊗⊙ ∗∘△ΘΞΦΩ
its all fine. ty again for the idea of creating a chatbot. when i find some spare time i ll try to implement it, like it is shown in the video.
Log in to reply
Your huge welcome!
andendswith:200 lol
Log in to reply
Very simple latex
;-) and can be copied (-;
@num IC i noticed you have been having problems with this Oren-Ben-Dov guy can you png me as a reply to one of his messages for me and i will leave a nice suprise making sure he does not do that again
Log in to reply
i just wrote to him. i assume he just have no idea how to have a fruitful discusion.
i dont want you to "send a surprise". i assume talking to him makes more sense.
but it would be nice if you could teach me, how to surprise someone. ;-)
Log in to reply
no it is solely on;y for me and percy as hamza has disgraced us and leaked it to another person specificly going against what it is for
@mention[10644076:Toska Pi] i cannot see your post since i m no premium member, if you have a question, please feel free to post it here.
Log in to reply
@Num Ic – Thank you, I'll remember that. This was what my post said from the shifting supports challenge: Hi again! This was a very helpful reply and it answered my question. Thank you for helping me out (even though my question was confusing to understand) :):)
Log in to reply
as i remember: the question was about "fixed CoM". you are welcome, i m glad that i could help
Latex is a bit confusing, to be honest. I don't really get it, but I don't think I need it much for Brilliant solution posting.
Log in to reply
@Jonathan Eshetu nice, you found the page ;-)
since you know how to code, latex will be easy for you. when u wanna try it, i offer my help.
but anyway i just refered to this page, so we can communicate.
Log in to reply
Thanks! :)
Can I also chat to you on here about python, instead of just latex? Just in case I have any questions.
Log in to reply
feel free to ask. there are better coders here, but i will help as good as i can.
i created this page by accident. i just wanted to test the latex output to avoid a post-change-post-chain.
but now i keep it bcs its convenient.
Heyo, someone give me a problem to solve with python.
Log in to reply
what about the daily challenges?
Log in to reply
I've already completed most of the ones that you could solve with programming...but thanks for the suggestion.
Log in to reply
Log in to reply
Log in to reply
Log in to reply
I'm assuming you meant b%i by the way.
Log in to reply
its not my intention to make u feel stupid.
there is an algorithm from euklid for gcd.
can you implement it as recursive function?
Log in to reply
What does euklid and recursive mean?
Log in to reply
its about a/b = x + remainder and then divide by the remainder and repeat until the final remainder is 0.
i propose to check the web to find it. i can explain it here, but one approach to programming is to find algorithms and implement them.
Log in to reply
Log in to reply
very good. you are fast. i would return the gcd, so it can be used instead of print, but as i said: very good and quick
Log in to reply
return a
instead ofreturn(a)
And nothing outputted when I called the function, so I got confused.Log in to reply
return just returns a value ;-).
to print it, call print(euclidGCD(34, 4))
Log in to reply
Log in to reply
to use it, it would be like:
g = euclidGCD(8, 4)
Log in to reply
since you already created code for the daily challenges, you can also check the coding solves by other users. its a good way to get some coding experience just to read coding done by others.
carsten kaminski writes very impressive code. it sometimes took me a while to understand his cool solutions.
Log in to reply
Log in to reply
like this
Log in to reply
thank you
, i didnt know thatLog in to reply
most certainly
welcome. I found it out on accident :)Log in to reply
coursera.org
i did the free course on this page:it is in russian, but i translated the pages (i ignored the videos)
Log in to reply
I've just been using Brilliant's python course and self-study, but that seems better.
Log in to reply
Log in to reply
Log in to reply
i just found this: Using Recursion (Python loop) and this: Break the Code
Log in to reply
Could you please explain, if you got it? I'm just scratching my head right now...
Log in to reply
for the second: its a nice example to show that it might cause problems if a function is used as argument for the function itself.
the return value is 3 + something. so i checked what happened if n=3.
_ = 4 will result in return 0 -> no problem
_ = 3 will result in return 0 -> no problem
_ = 2 will result in return 3+something -> might cause a problem
but you can also use a loop and call the function with different values to check the results. i do this sometimes to figure out if there might be an error.
have u checked the russian course?
Log in to reply
If n = 5, then 4 3 and 2 all result in leaving something....right?
And no, I haven't checked the course out, sorry! I'll get to that soon.
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
The reason it's 2 is because eventually, the program will simplify to
3 + rec(3)
Because when you keep subtracting the number, it will eventually go below 0, and then everything will simplify to the above equation. But when you calculate the return value, it becomes
3 + 3 + rec(rec(3-_)
, and if the blank is less than 3, it will result in rec(natural number), which causes an infinite loop. Eg.3 + rec(rec(5-3)); 3 + rec(rec(2)); 3 + rec(3 + rec(rec(2-3))); 3 + rec(3 + rec(rec(-1))); 3 + rec(3 + 0); 3 + rec(3) (it always simplifies to this); 3 + rec(rec(3-3))) (since the blank is 3, the rec function goes down to 0); 3 + 0; 3; However, if it was say 2; 3 + rec(3); 3 + rec(rec(3-2)); 3 + rec(rec(1)); 3 + rec(3 + rec(rec(1-3))); 3 + rec(3 + rec(rec(-2))); 3 + rec(3 + 0); 3 + rec(3); Hence the infinite loop.
Log in to reply
u can also test it in the coding environment here.
nothing bad will happen. there will just be a message that there are too much recursions.
i did the test with _=4 and n=10000.
Log in to reply
Log in to reply
have u seen that carsten proposed two webpages?
have u checked the community for coding problems, that are posted by the members?
Log in to reply
A website I just found out, that I'm going to use a lot now, is edabit.com. It has a bunch of different challenges anywhere from Very Easy -Expert, with a ton of different languages.
Log in to reply
Log in to reply
@num IC this explanation was actually a bit off, as the pattern goes:
3 + rec(3)
3 + 3 + rec(rec(3-3))
3 + 3 + 0
6
or in some cases;
3 + rec(3 + rec(3))
3 + rec(3 + 3 + rec(rec(3-3)))
3 + rec(6)
3 + 3 + rec(rec(6-3)
3 + 3 + rec(rec(3))
3 + 3 + rec(3 + rec(rec(3-3)))
3 + 3 + rec(3)
3 + 3 + 3 + rec(rec(3-3))
3 + 3 + 3 + 0
9
But I'm assuming you see the pattern by now.
Log in to reply
i had four spaces before the 4, but it seems not to work.
btw: u can test such things by creating a note.
but u can do it here too ;-) (if the others in this chat are annoyed, they will unsubscribe this chat)
the recursion depth is limited, so big input values will cause a problem even with _=3 and _=4.
task: create a short code to find the max recursion depth.
Log in to reply
Log in to reply
eg factorial 4:
-> recursion depth 4
Log in to reply
can you solve this with python?
maybe this is better
Log in to reply
Log in to reply
this is a proposal for a coding environment: repl.it
this is for learning: realpython.com
(the 2nd seems to be similar to your edabit.com)
I need to test my programming skills.
Log in to reply
i can sure propose something, but i would prefer if people use "please" when they ask for something.
Log in to reply
Sorry about that.
I was a bit....impatient when I wrote that. Completely my fault. Could you please?
@Mahdi Raza hello Mahdi Raza , you created a very nice animation in this daily problem: Sum These Segments. what tool can be used to create such an animation? or did you move the lines by hand, step-by-step?
Log in to reply
Hi, I have used Keynote. I grouped the lines and then rotated. Refer this if you have any more questions
Log in to reply
this is great ty. i checked your pentagon. there you mentioned keynote. i thought that was only a kind of a powerpoint clone. but you are creating very impressive animations. ty for that and ty for the hint.
Log in to reply
@num IC It was getting cramped earlier, so I'm just making a new post to continue our conversation.
1) I checked out repl.it, it seems pretty helpful, but realpython seems like basically pay to python.
2) Still working on those 2 problems by the way (smallest 10-digit number and recursion depth.) :)
3) I was thinking earlier, isn't there a much easier factorial function?
Log in to reply
yeah. and it is faster, since a function call takes more time than a loop.
it is just used as a simple way to understand recursions.
you can also use carstens codes to understand recursions ;-)
ty, i didnt check realpython. i just saw that one did recommend it.
for recursion depth, a simple code is enough. just dont be affraid.
Log in to reply
Here's the program I used for the 10 digit problem:
Log in to reply
Log in to reply
And isn't the recursion depth infinite?
As for any number, it would keep subtracting _ until the number became <= 0, and the number could be infinitely large...
Log in to reply
Log in to reply
For starters, I edited the function a little bit, so that it measures how many times the function is called.
1) Since it's steadily increasing, isn't the depth infinite?
2) This is crazy. If you add 1 to each of the depths, you end up with a very noticeable pattern.
4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, 64... Why would powers of 2 appear here?
Log in to reply
but there is a missunderstanding. my intention was not to check the depth of this particular function. (50 is much too low to test this one).
its more easy to use a simple function that just increases the given value.
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
currently i feel a bit incapable bcs i am not able to express that intention clear enough.
have you found some interesting tasks on edabit.com?
Log in to reply
Don't feel incapable, if anything my limited python vocab is stopping me from understanding.
I've just been doing easy tasks for now on edabit, but I've started switching a bit more to repl.it
Log in to reply
do you reccomend them? do you have questions?
Log in to reply
Ex. stutter(python) -> py...py...python?
I have the idea, I just don't exactly know how to code it.
Log in to reply
print(t[:2]) what did u use to get the first 2 letters?
Log in to reply
a string is an array, just filled with chars
Log in to reply
Log in to reply
this is a good idea to train using strings and dictionaries:
https://brilliant.org/problems/you-ninja-name/
Log in to reply
sorry this is so late.
Log in to reply
Log in to reply
and ty: i was not aware that there is no direct access from value to key.
i assume that is why they created that reverse dict in the solution.
Log in to reply
Log in to reply
Log in to reply
engText = ""
and then:
engText += key
but good to know how to convert an array into a string.
Log in to reply
Log in to reply
Hey @num IC, I finally made a one liner!
Basically, it takes a number, returns its divisors, the sum of its divisors, and if it's a perfect number (a number where the sum of its divisors equals itself) or not.
Try it out!
Log in to reply
very cool.
its possible to skip long lines by using \
and i know that for some ppl it is a challenge to solve problems in few lines, but it is more easy to read code if it is split into several commands.
and i m impressed: you already know more about how to use the print command than i do.
so i should try to catch up again ;-)
Log in to reply
I knew I could make the code a lot more compact if it was in several lines, but I wanted to see if I could do it in one, yknow?
Log in to reply
Log in to reply
Log in to reply
Log in to reply
i really recommend the corrected coursera page that i posted.
coursera learn python
that was one task i liked:
korovay
it has to return correct russian word for cow (korov, korova or korovy):
For a given number n <100, finish the phrase “Grazing in the meadow ...” with one of the possible continuation: “n cows”, “n cow”, “n cows”, correctly declining the word “cow”.
Input format
A natural number is entered.
Output format
The program should print the entered number n and one of the words: korov, korova or korovy. There must be exactly one space between the number and the word.
Note
If Russian is not your native language and you find it difficult to cope with this task, you can find a hint on declensions here: https://www.coursera.org/learn/python-osnovy-programmirovaniya/programming/rsYze/korovy/discussions/threads/-FJYlWcKEeiMwRLm6nkdwA .
"n коров" if 10 <n <20 or the last digit of n is one of 0, 5, 6, 7, 8, 9.
"n корова" if the last digit n == 1.
"n коровы" in all other cases.
Log in to reply
Log in to reply
its a double challenge to code, when the task is given in a foreign language ;-)
i saved some of the tasks, but i saved them translated to german not english ;-(
@Percy Jackson you asked for sides to learn python.
i did the free course on this page: coursera.org
it is in russian, but i translated the pages (i ignored the videos)
a member here recommended edabit.com (it seems to be a free page to learn python).
other pages:
realpython.com (might be pay to use) repl.it (online coding environment)
Log in to reply
@Percy Jackson ty for showing your javascript code for the candy problem.
it helped me a lot to understand javascript.
i found a nice solution to change the speed.
if you want to see it, i can post it here.
Log in to reply
Ok, you can post it here. Thanks :)
Thanks :)
Log in to reply
javascript:
Log in to reply
I wish you success with your exams.
Log in to reply
@Percy Jackson @Jonathan Eshetu
i m not sure if i linked the correct coursera course.
this is the one i did: https://www.coursera.org/learn/python-osnovy-programmirovaniya/home/welcome
@Mitch Connor
I have deleted my solution for the problem, but I apologize for the incorrect equation. I got them mixed up, which is completely my bad. Thanks for telling me!
Hey @num IC , I have a quick question, if you're here
Log in to reply
hi. i m here now.
but since i still have to understand some of the lines from your cool code, i m not sure if i really still can help you ;-)
Log in to reply
haha, thanks ;-)
I can't stay for long, so sorry if i don't respond, but say I was making a text rpg in python
in this rpg, i plan to have an effects system, ex. an attack inflicting the opponent with burn, poison, freeze, etc. etc.
what would you say is the most efficient way to do this? the player has a class, so you can add attributes if necessary. here is the class code (done by me)
as you can see, i have effects in the attack setting, but how should i go about adding it in an actual battle? going through a bunch of if statements (if attack[2] =="Burned", if attack[2] == "Freezed", etc. etc.) making a dict to match effect name with effects? thank you in advance! I have to go now, so i'll respond tmrw morning!
Log in to reply
if the effects are different then a dict sounds like a good idea.
Log in to reply
so this is all being done on repl.it (remember that), so if you have an account, I can invite you to the repl ;)
however, i'm not the owner, so i'll have to wait until the owner gets online.
Log in to reply
Log in to reply
so would you like to join? i'd invite you some time tmrw, and we could really use the help lol. i understand if you say no ;-)
Log in to reply
i ll try to find some energy to create an repl acc.
Log in to reply
Life's sometimes that way, but who says you can't do all those things this year, or maybe more?
Plus, you don't have to worry about final exams ;-)
Log in to reply
Log in to reply
could you do me a favour and check what brilliant has written here? https://brilliant.org/daily-problems/circles-parallelogram/?from_notification=15616976#!/dispute-comments/36816/
i cant check because i dont have premium
Log in to reply
I've marked this report as resolved."
Log in to reply
Log in to reply
don't forget to tell me if you make a repl acc lol
i checked if your nice solutions runs in bril env.
i used that as input:
and it worked well. i tried this too:
and got 0 solutions.
it does not matter for the designed purpose, but i assume u will process input data in the future too.
Log in to reply
Yeah, I set it to
.split(" + "), .split(" - "), and .split(" = ")
, so that's why it does that. If I remove the spaces, it might count them as numbers...Log in to reply
Log in to reply
@Paul Romero Bello sry for the deleted msg, i tried to get your mention id, to "invite" you to this note.
the 2 links in this note are very helpful. i found some more too. and i can help whenever you are ready to try some latex.
additional: an idea to post a solution without pictures would be:
51234
23451
12345
34512
45123
lol, the numbers where just cycling. i have not recognized that before.
Log in to reply
You are very kind. Thank you :)
Log in to reply
you are very welcome.
first "challenge": copy the next line and send it as reply
\(\boxed{\LaTeX}\)
Log in to reply
LATEX
Log in to reply
voila, your first latex post :)
did you check how it works? or maybe you know it without reading the links.
Log in to reply
Log in to reply
LATEX
wait, i'm a bit confused onhow exactly does it work?
so what if I...
LATEX
Log in to reply
Log in to reply
abcdefghij
Log in to reply
Log in to reply
upmiddlelow
very good. can you do this?:Log in to reply
upmiddlelow ?
hm....upmiddlelow
highesthigherhighmiddlelowlowerlowest
Log in to reply
highesthigherhighmiddlelowlowerlowest
i have to try thati don't mind the pings. i enjoy the interaction with you two.
@Paul Romero Bello please feel free to try it too.
if you don't want to get pings from this note, then you can click "unsubscribe", but i'm not sure what kind of notifications you will still get then.
maybe you want to use this. just an alternative to using percy's ;-)
i'm still curious. i assume a mac has a screenshot function?
else you might have something similar like snip&sketch:
when the "print" button is pressed, it offers some screen capture options.
i don't have a mac, but the web says shift-command-3 create a screenshot.
u said u use a pc-keyboard, so i assume the command key is different from the funktion key. is it?
Thanks for the link. The way I interpreted it was this: take any group of two students, there are 60/2=30 and there are 60 x 3 = 180 possible answers of which 60 x 2 =120 correct whatever the distribution. 60 answers are either all right, all wrong, or a combination of right and wrong. Person A could get Q1 right, and person B could get Q2 right. That's 2 questions right between 2 students. Or, A and B both got Q1 right but C and D got Q2 right. Or, if person A got Q1 right, B got Q2 right, and C got Q3 right, then D could have gotten Q1 or Q2 right or even Q3. I'm probably making too much out of this.
Log in to reply
i just copy the statement, so it's more easy to compare.
"During an examination, 60 students had to answer 3 questions. After the examination, it's shown that for any two students, there is always at least 1 question which both students could solve."
it deprnds on the original wording but 60/2 is dividing the 60 students into groups of 2. but any two students would be 60*59/2 (combinatorics: pick 2 out of 60).
so this is much more than 30.
regarding the 1 question that both could solve. the wording indicates that both had the same question correct.
and as i said: the total number of questions is not stated. it could be the 3 same questions for all 60 students, but it could be more depending on the conditions of the problem.
the problem like you described it sounds more like:
60 students are divided into groups of 2.
each group had to answer 3 questions. both students answered individually.
every student gave at least one correct answer.
i was used to program in basic and c, but python is very nice.
i'm still on my way to understand how to use python-goodies like range and permutation.
but please feel free to ask questions regarding coding. it would be a pleasure for me to help you.
Log in to reply
Thank you. Long ago (30 years) I used Fortran, Watfive, Pascal and Pascal took the lead. I got into a lot of Finite Element modeling with programming but quickly canned programs came on the scene in the form of software. So, I drifted away from programming and relied on software. But I'm impressed with the flexibility Python offers and want to learn it. Been doing a little here and there but get lost in the goodies (permutations and other libraries). I'll be sure to take you up on that with questions as they arise. Thanks again!
Log in to reply
i dont know watfive. i will search that.
you said you'r a bridge engineer. that sounds very interesting.
Log in to reply
fortran whatF iv was harder to find, they looked a bit like assembler code.
Thank you! I didn't even consider that there could be more than 180 questions. Just assumed they were the same 3 questions.
Log in to reply
hm i assume 180 is the maximum if all student get different questions.
(there might be more but that should be mentioned like: ... had to answer 3 questions out of a set of questions.)
my first assumption was: all students get the same 3 questions.
i still assume this is the idea. but i have no idea what the question behind that setting is.
is this the original wording or is it just a draft for a challenge that you prepare?
Log in to reply
It's the actual wording of a problem in the challenges community I believe under logic. The writer intended for the groups of two to get the same question right. But I thought there could be different interpretations.
Log in to reply
just use this without the blanks: [ some text ] ( html )
Log in to reply
Log in to reply
Log in to reply
"there is always at least 1 question which both students could solve."
--> implies that each student had at least 1 question solved.
--> if even one of them only scored 1/3, then that particular question must be solved by 59 others to make this claim true. We can see this in just a group of three, let ABC be the students and 123 the questions. Say q1 is the easiest one, so average students A and B could only manage that one. But even when brilliant C solved the other difficult two, but made careless mistake / ran out of time on q1, the claim will be invalid (A1, B1, C23).
--> if there are no 'easy' question which is scored by ALL the students, then all 60 must have solved AT LEAST 2 questions each.
Log in to reply
Thanks! I knew you'd make sense of this one. You are both a logician and mathematician.
Log in to reply
Thank you, Joe, but that compliment is too high for me. I am still struggling when confronted with questions under category group theory. Too much lines and nodes than I can handle. And sorry I didn't think deeper than taking it as the 60 are just the usual class of hs students answering the same 3 questions. Perhaps the assumptions brought along from Three Questions problem we just had around Xmas.
Log in to reply
if you love math then you might like this question: Minimum value of equation - Exam Edition
i got scrambled so i used wolfram alpha to solve it.
regarding 'beating a dead horse': hint: each char is coded as 2 digit number.
meaning: to waste effort on something when there is no chance of succeeding.
(beat a dead horse)
(i assume he wants to say that there is no benefit in discussing the different ways of solving the challenges. - in my opinion the expression does not fit here very well.)
in old times some riders did beat a horse to make it run faster, but if the horse is already done then this will have no effect.
Log in to reply
Expression means "We've discussed this so much and in so many ways but aren't making any progress." I value different approaches and don't understand why people think they have the ultimate solution. It's like asking, "who's better - the republican or democratic nominee? Obviously it depends on what you value. So, I'm advocating that all approaches that yield the correct answer are valuable. The lengthy one that experts find redundant appeals to the person who lacks that knowledge to solve. The programmer who has solved many cryptograms and is honing his programming skills is saving time but providing knowledge to those who don't know programming. Etc.
Log in to reply
my hope is that the discussion helps the critic to understand that there is a value in presenting different solutions (even coded ;-).
i can tell you how the first coding was done, but i assume you want to try it by yourself first.
Log in to reply
Thanks, num IC! For the horse proverbs explanation and the hint, but still I'm getting no progress. I don't understand 2 parts there, one is the many 7 there (though your reply had an almost balanced quantity of 6 & 7), and the other is why there are abcd included there too.
Log in to reply
Log in to reply
Sorry if these are stupid questions, but I don't know where to find the answers online. Sometimes what's provided isn't answering all my queries. Thanks for the hexadecimals, both of you!
Log in to reply
In true encryption, alphabets are completely jumbled and the position of the alphabet matters and what lies next to the alphabet matters… u get the point I think, but Broekhuis had to make one which was crackable
The key is what is required to decrypt the sequence, without it becomes too hard to decrypt, in this example my post down below has a key which is the dictionary and the key can be sent with the message, but only knowing how to use the key can decrypt the message
U can do anything in encryption until it is possible to decrypt to a single message back again, if that can’t happen, that’s not an encryption, that’s data loss scheme
Log in to reply
Log in to reply
Log in to reply
@num IC did u try this
Ok I have been trying to solve this monster but to no avail, I am not even able to eliminate enough to get the idea of assuming and checking for contradictions, this is truly requires a computerLog in to reply
Joe did select it very well to make us use a computer.
Log in to reply
@Joe Byrne u completely got me
Nice joke playedLog in to reply
Log in to reply
Log in to reply
the sample was easy bcs he said: here is the text and this is the encryption.
but without the original text or other hints it can be very difficult to decode something.
Log in to reply
Log in to reply
Log in to reply
Log in to reply
jason gave a good hint: i'm used to treat hexadecimals as numbers.
(so i refer to a, b, c, d, e, f as numbers too)
with this you can decode every two "numbers" to represent a char.
so "beating a dead horse" = 79767a67 726d7420 7a207776 7a772073 6c696876
decrypts by: 79='b', 76='e', 7a='a', ...
@Ömer Ertürk please feel free to join the discussion here if you have some questions regarding python
@Andrew Last i have never posted a zip-file on brilliant, but would it be ok for you to post a link to your python code for the Decanting Decision animation here?
or maybe the code is short enough, so you could just put it here as a normal post?
(i just downloaded manim, so your code would be a good introduction to understand that tool.)
it's fully ok if you don't want to post it.
@Zakaria Sabbagh i propose to discuss programming items here, to not disturb the challenge posts.
can you tell me what kind of program you already have coded? eg: do you know how to add two variables and print the result?
Log in to reply
Thanks you for your invitation.
I am a new member in Brillant.org I joined two days ago for the first time and was amazed to see programming solve complex equations and wanted to try to learn, but I feel drown into a maze and I do not know where to start !
In fact, I still did not get the first course in programming yet but I have the desire to learn. I am specifically interested in programming that solves mathematical equations
Log in to reply
ok. what kind of programming have you done already?
have you opened the brilliant coding environment?
Log in to reply
I didn't know there is anything called coding environment here, i only open when you share for me, in fact I spent all yesterday searching specifically for these coding side, where I can print codes, on the internet! and I couldn't understand why it was so difficult to get it as if it were a miracle!!
And after a long suffering I found these two links:
https://ide.geeksforgeeks.org/wlPGBtBkJB
https://www.programiz.com/python-programming/online-compiler/
Then I tried to solve a new equation by copying and modifying from some answers here that used python. I finally succeeded in writing correctly the new equation code but I did not get result and it seems that the program I use is not very developed and it said : time limit exceed!
Unfortunately, I do not know how to add and code two variables and I want to learn from zero
Log in to reply
https://inventwithpython.com/ (This website has several programming books, I recommend "Invent Your Own Computer Games with Python, 4th Edition", not only for games but because it generally teaches you)
https://edabit.com/challenges/python3 (This website has numerous different challenges, ranging from very easy to expert)
From there, I recommend you just start programming! 99% of any questions you have have been asked before online, so just search it up! This is more or less how I started programming.
Log in to reply
Thanks a lot!
Log in to reply
please feel free to ask if you have more questions or if we can help with some programming issues.
even if it sounds strange: it's a good idea to start with a simple "Hello World" program,
this makes sure the coding environment and the output works.
a disadvantage of the brilliant coding environment is that it cannot handle the input function (so at each run, the input has to be set manually. but i use it mainly to create solutions, so no input is required) and the brilliant environment is very slow compared to other coding environments.
but it's nice, because it is already here ;-)
Log in to reply
Yes you are right and nothing strange if I start with "Hello world", i am not just interested in learning some codes and how to enter it, but I tend for Intense understanding and i need understand how these codes and programming fundamentally work
i have read the free introduction of brillant python programming courses and i find it great, now i would like to go more deeper i think i want to read the "Python Crash Course: A Hands-On, Project-Based Introduction to Programming" by Eric Matthes which I found in the link that Jonathan recommend
I don't face problems till now, i am still in the beginning and before diving but i will provide with your pinwheels so i am not afraid of drowning! I really feel grateful for your interest and your encouragement
thank you all
Log in to reply
Log in to reply
But if you mean my PC python program so I do not have PC and it does not matter
Log in to reply
Log in to reply
yes.. thank you very much
@num IC.Hi, I m working on quite good Python projects Would yu mind if you take part in it?
Log in to reply
oh ty for that. i forgot to create an account. was it repl.it?
Log in to reply
hmm
I would be glad to be involved in interesting Python projects if you invited me :)
Same here :) @SRIJAN Singh I already have a repl.it account created, and i've been waiting for num IC to create one for a while too, haha
Hi,
I am working on a small python program that has not finished yet, I reach there..
But i have thousands of outputs and look separated like this:
27
9
36
etc.
how can I combine the outputs in one tuple or one list to continue working on the variable y?
Log in to reply
ok. what shall this code do?
ty for using 3 of these ` before and after your code :-)
does that out-variable solve your request?
Log in to reply
Thanks for you note.
I am trying to prove a mathematical issue which is if you take whatever number and subtract it from another number composed of same digits the result is always multiple of 9 e. g.:
759 812 − 285 917 = 473,895 equal 9 * 52,655 (mean multiple of 9)
or 759 812 − 571 289 = 188 523 equal 9 * 20,947 (mean multiple of 9)
Log in to reply
(there is a mathematical proof but i like the idea to brute force it)
Log in to reply
You are shrewd 😃 and I did not think the answer was so simple, I should have ask from before 🙃, thank you very much
And here is the sequel:
for n in range(12345,12355):
while u are evaluating the codeLog in to reply
But I don't know why I still have many 9s instead of one 9 output!
Log in to reply
I think this will be helpful to anyone who sees num ic’s encrypted text
Log in to reply
very helpful. ty.
Log in to reply
Log in to reply
now i use it for several discussions (mainly python).
no, just the reply that i gave to Saya.
Log in to reply
Log in to reply
ty for that idea. since i'm to lazy to input the dict, i would use this detranslator:
Log in to reply
I did know there will be an iterative solution but I was too lazy to go and find the ASCII values back again lol
Log in to reply
Log in to reply
but it should be easy with a loop. why don't you want to use a loop?
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
ivd = {v: k for k, v in dec.items()}
but you have to be careful if two keys refer to the same value.
Log in to reply
i would use this to create the both dict:
Log in to reply
Oh this works for dictionaries as well I thought it did only for lists, well it’s easy to see the contents are being reversed/inverted so I will use it, thanks
@Saya Suka you can use this Latex code to make the look of your todays formula more 'chemical':
\(\ce{4Fe + 3O2 + 6H20 -> 4Fe(OH)3}\)
\(\ce{O2}\)
Log in to reply
Thank you for this offering, num IC! I am gladly accepting this, humbly. Ty again!
Log in to reply
you are very welcome
Log in to reply
Family, “A”, goes to a restaurant on any given night 2 times every week at 5 or 6PM. Family, “B”, goes to the same restaurant 3 times every week between the hours of 5, 6, or 7PM. What is the chance they will meet during a specific 1 hour period of time? What is the chance they will meet during any one hour window of time? In these cases each family stays for one hour. What is the chance they will meet during any consecutive 2 hour period of time if they stay for the two hours? List you answer as the sum of these probabilities in percent to the nearest 1/100th.
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
https://brilliant.org/problems/some-more-probability/
https://brilliant.org/problems/i-prefer-that-you-wait/
Log in to reply
Log in to reply
Log in to reply
5:00-6:00 has less probability of A coming but 5:30 to 6:30 has a higher chance(A has to be in this time period for 30 mins atleast if he comes on that day)
Log in to reply
Log in to reply
491 and the second should be 18917
Ok so first probability should beLog in to reply
Log in to reply
@num IC and @Saya Suka have a chance to solve, or I may influence their thinking. And I could be wrong.
Our answers are close, within 1% both cases. Mine is higher in the 1st case, and lower in the 2nd. But I don't want to provide methods untilLog in to reply
for the chance that they pic all different(!) days i got:
2/7 * 1/6 = 1/21, so the chance that they have at least one day in common is 20/21,
which seems to be quite high.
anyway i assume we have to calculate the chance that they have 2 days in common too.
but i struggle to understand this 'they meet during a specific 1 hour'.
in my understanding this means they are at the location at the exact same time.
but what is the granularity?
do they either arrive at 5 and leave exactly at 6 or arrive at 6 and leave at 7?
what happens if they arrive at 5:15? do they leave at 6:15?
does that mean the other family has to arrive at 5:15 too bcs all stay for exactly one hour?
what happens if the granularity is one second? or even smaller?
a finer granularity would decrease the chances.
if the granularity is 1 minute and the stay-time is exactly one hour,
then (if both are on the same day at the restaurant) both can arrive at
5:00, 5:01 ..., 5:59 or 6:00,
so the chance that they are in the restaurant at the exaxt same hour would be 1/61.
is my understanding so far correct?
Log in to reply
Log in to reply
Log in to reply
If you take a random day, the chances that family A is there is 2/7 and family B is there is 3/7.
multiply them to get 6/49.
from there, the chances that they have the same time is...
A has 2 possible times.
B has 3 possible times.
2*3 = 6, only 2 times actually work (5 to 5, 6 to 6).
2/6 = 1/3.
multiply the possibility of them being on the same day and them being on the same time (6/49 * 1/3) and I got 6/147
Log in to reply
i have to re-think that 2/7 and 3/7 part (i hope you are right bcs that would be easy to calculate), but i assume it misses the part when they have two days in common.
Log in to reply
Log in to reply
but it is 0.03
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
(kN)
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
The first question raises two dilemmas:
First dilemma is based on days and regardless of timing and related to the total number of times to go to the restaurant and from whose point of view, family A or family B or me? e.g. in 35 weeks (family B possible combinations) they meet 30 times (20 times one meeting a week and 5 times two meetings a week) but the total number of visits is 70, 105 and 175 respectively from the family A, B and my point of view!!
Second dilemma is related to timing i mean the question by itself: what is the chance they will meet during a specific 1 hour period of time?!!! but this period should be fixed and precised, and there are four different cases for timing:
5 to 6
between 5~6 to 6~7
6 to 7
between 6~7 to 7~8
And there is different probabilities: 1/1 for second case and 1/2 for other cases and a confusion with the average concept happen here!
And the complications increase for the second and third questions...
Log in to reply
Log in to reply
Maybe you are right, I overreacted in the forms but in context I still see that what I mentioned above are real obstacles
Sorry for my language, this is the best I can speak
Log in to reply
Log in to reply
Yet, I am only dealing with the first question and should be solved in the help of the following points :
the chance they go to the restaurant in same days and regardless the timing per hours
In the next stage , the chance they will meet together in the time by hours
First of all, Family A has 7C2 = 21 combinations and family B has 7C3 = 35. For the first point, whatever are the 2 days family A go to the restaurant, there are 5 chances they meet family B in both days and 20 chances they meet only one day. e.g. family A go on (W, F) they meet family B both days as following: (M, W, F), (T, W, F), (W, TH, F), (W, F, SA), (W, F, SU) and only one day as following: (M, TU, W), (M, TU, F), (M, W, TH), (M, W, SA), (M, W, SU), (M, TH, F), (M, F, SA), (M, F, SU), (TU, W, TH), (TU, W, SA), (TU, W, SU), (TU, TH, F), (TU, F, SA), (TU, F, SU), (W, TH, SA), (W, TH, SU), (W, SA, SU), (TH, F, SA), (TH, F, SU), (F, SA, SU), however in the first 5 cases they meets in both days and it should be calculated as 10 chances because when the second point above is discussed, the timing by hours depends on every day and they can not meet or they meet one time or two times, and the total is 10+20=30 chances. the penultimate note, whatever family A combination is, such as (M, SA) or (TU, TH) etc. there are always 30 chances. now is the probability 30/42 or 30/70 or 30/105 or what??? I have no answer and i need to finish this issue before moving to the second point
Log in to reply
so the question is just about the chance to meet in one week, not in x weeks.
regarding the time: i had the same question.
i learned that the idea is that they can only arrive at 5:00, 6:00 or 7:00,
(they cannot arrive at 5:15)
Log in to reply
Log in to reply
this is my way to check if i did something wrong.
Log in to reply
This was my reasoning for the two parts
Log in to reply
Log in to reply
Log in to reply

it is similar to posing a link but has a '!' as first symbol.
here is a short description at line 8
Log in to reply
Log in to reply
@Joe Byrne Can mathcad solve simultaneous non-linear six variable equations?
Log in to reply
https://en.smath.com/view/SMathStudio/summary
Doesn't have the level of support but has examples. It's tailored after Mathcad...probably written by one of their software engineers. So, I could help you if you have any questions about use. Or, if you buy Mathcad, you will get plenty of clear examples on how to use.
Log in to reply
here I’ll put the equations here also but there isn’t much space so it might not come fully
Could you solve the six equations posted in my discussion(i=1∑6pi2)(xj=1∑x−1pj+j=x+1∑6jpj)=2pxj=2∑6jpji=1∑j−1pi,∀x∈{1,2,3,4,5,6}
Log in to reply
p1,p2,p3,p4,p5,p6 are the variables
Log in to reply
Log in to reply
Log in to reply
Log in to reply

but it wouldn't work.
Log in to reply
like shown here
can you tell what u did? maybe we can help.
Log in to reply
Log in to reply
regarding posting pics: whenever u want to do it: just ask when u want us to give some more explanations.
Log in to reply
Log in to reply
Log in to reply
Log in to reply
1) we have P(A dining there) = 2/7
2) we also have P(B dining there) = 3/7
P(both families dining there on the same day) = (2/7)(3/7) = 6/49
So, 49 days is 7 weeks, and in that time A would have been there twice a week for a total of 14 times, while B with 7 weeks x thrice a week = 21 times.
Total days in 7 weeks that the restaurant have at least one of the families there
= (14 - 6) + 6 + (21 - 6)
= 8 + 6 + 15
= 29
Days that neither went = 49 - 29 = 20
Log in to reply
Log in to reply
For a) & b), the divisions are depicted as below :
A ==> 1/2 + 1/2 + 0
B ==> 1/3 + 1/3 + 1/3
For c), the divisions are depicted as below :
A ==> 1 + 0
B ==> 1/2 + 1/2
I took your a) as that mutual acquaintance situations, so it would be the same 1/49 for both the first and second hour, p(at 5) = p(at 6) = 1/49 but
p(at 7) = p(A at 7) x p(B at 7)
= (2/7) x (0) x (3/7) x (1/3) = 0
For c), p(spending 2 hours together)
= (2/7) x (1) x (3/7) x (1/2) = 3/49
Log in to reply
= P(both choose same day) x P(both choose same time slot)
= (6/49)(2/6) = 2/49
Log in to reply
Here's what I got:
a) Pa=1, Pb=(15/35)(1/3), Pa*Pb=(1)(3/7)(1/3)=1/7 b) P=(1/2)(6/21)(15/35)(1/3)=1/49
Please tell me what you get. Thanks!
Log in to reply
Log in to reply
are you aware that mod in programming is different than in maths?
i saw that 10.5 % 3 is 1.5
afaik in maths mod is defined only for whole numbers.
just a test
Log in to reply
@Chelsea Saunders hello, i assume you posted a video-solution to the yesterdays daily problem (Double the Fun).
i just wanted you to be aware that the video shows the tabs of your browser.
nothing to worry about this time (the sherlock video seems to be interesting :-)
but please be careful to avoid showing some personal data in future videos.
Log in to reply
Thank you, but I checked what was visible and saw that it was nothing secret
Log in to reply
btw: what tool did u use to record this video?
Log in to reply
Log in to reply
i don't know why it says xbox.
Nice of you to warn him :)
@Jason Gomez FYI - you can get a student license for Mathcad for $60 from PTC Web Store for one year. And Maple Soft has a similar product student license for $99 for a year. Both require Student ID verification. If I weren't so used to Mathcad I'd probably switch to Maple Soft. Worth looking into.
It's said that this problem is unsolvable! can you prove the opposite?
A teacher randomly distributes to his 25 students their 25 papers. Calculate the probability of the following events:
A - "each students gets his paper"
B - "only Samir gets his paper"
C - "a single student does not get his paper"
Log in to reply
A- 25!1
C- 0
B- 25!D24≈25e1
Log in to reply
What does it mean! Can you write it again in more simpler form?
Log in to reply
It means de-arrangement and this one exactly means the number of ways to de-arrange 24 objects such that none of them remain in their original position, check this wiki out
Log in to reply
Log in to reply
25!D24=251(0!1−1!1+2!1−3!1+…+24!1) it’s a really bad number to calculate
@Jason Gomez the algorithm by itself cannot give a discount, but i assume if you ask the staff they might be able to check that for you.
you could tell them that your premium abo ended. and if there currently is a discount available for you.
if they don't make an offer, you could also ask if you should wait until the next season offer (easter time is close).
sorry i try to avoid giving advices without beeing asked for. please tell me if this advice is unwanted, then i'll avoid that in the future.
Log in to reply
No I really want advice, I don’t want to sound like some cheapskate not wanting to pay more, when ofc this website is worth more than its weight in gold, so it’s really hard for me to ask as well, free advice given is always accepted by me especially in this situation when it’s quite awkward
I didn’t know there were season offers, I was pondering on my option of not subscribing because I may go (mostly infact) inactive after May
Log in to reply
i saw some offers but i don't really know if there are season offers.
if you rich then i apprechiate if you support brilliant even when you are inactive.
i'm poor so use only the free access, and thb: this already has a lot of content.
so if u are not rich, then why not pause the sub while u are not active.
Log in to reply