Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Math Brain Teasers
- BookOwl
-
1000+ posts
Math Brain Teasers
I recently solved the Alien abduction brain teaser from Khan Academy. Does anybody know of any other sites with math puzzles/brain teaser?
who needs signatures
- NoMod-Programming
-
1000+ posts
Math Brain Teasers
Alien abduction brain teaser from Khan Academy. Does anybody know of any other sites with math puzzles/brain teaser?I recently solved the http://www.braingle.com/Math.html try there
Long-since moved on from Scratch, if you need to find all my posts, search this in google: 3499447a51c01fc4dc1e8c3b8182b41cb0e88c67
- Hamish752
-
1000+ posts
Math Brain Teasers
Alien abduction brain teaser from Khan Academy. Does anybody know of any other sites with math puzzles/brain teaser?Not the right forum. Try the reading/playing or maybe making/creating. I recently solved the
- DigiTechs
-
500+ posts
Math Brain Teasers
This is totally on-topic though.Alien abduction brain teaser from Khan Academy. Does anybody know of any other sites with math puzzles/brain teaser?Not the right forum. Try the reading/playing or maybe making/creating. I recently solved the
Math(s) comes under programming and is an advanced topic.

I do, in fact, have my own site; it's here.
I'm also working on a thing called Fetch. Look at it here!
@thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain.
- gtoal
-
1000+ posts
Math Brain Teasers
Alien abduction brain teaser from Khan Academy. Does anybody know of any other sites with math puzzles/brain teaser?I recently solved the https://projecteuler.net/
- SuperDoom
-
1000+ posts
Math Brain Teasers
7/2*10-10(100-2*5*4)
-565 or -599.65?
-565 or -599.65?
WARNING: Anything I post is either stupid, sarcastic, or ironic. I am not to be taken seriously. Feel free to make fun of me for anything I say.
“Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety.”
essentiallibertyisfreedomofspeech~Benjamin Franklin (This is my motto for replying to suggestions.)
As of 83G1NN1NG/0F/71M3, I use color #322F31 for my posts. If it's a link, I use #1AA0D8.
CLICK THIS LINK TO INSTANTLY CRASH THE SERVERS
Alexa, play Space Invaders.
3000 • 3500 █ 4000
As of November 7th, 2019, I have my computer back.
I'm awake from 11:00 AM to 11:30 PM CST (12:00 PM to 12:30 AM EST). Please be more active during that time.
I've moved to -THENEXT_LEVEL-.
- BookOwl
-
1000+ posts
Math Brain Teasers
-599.65 7/2*10-10(100-2*5*4)
-565 or -599.65?
who needs signatures
- ev3coolexit987654
-
1000+ posts
Math Brain Teasers
-250 7/2*10-10(100-2*5*4)
-565 or -599.65?
- gtoal
-
1000+ posts
Math Brain Teasers
7/2*10-10(100-2*5*4)
-565 or -599.65?
-565
/ \
/ \
/ \
/ \
/ 600
/ / \
/ / 60
/ / / \
35 / / 40
/ \ / / / \
3.5 \ / / 10 \
/ \ \ / / / \ \
7 / 2 * 10 - 10 (100 - 2 * 5 * 4)
/ and * are at the same priority level and are handled left to right.
Last edited by gtoal (Aug. 1, 2015 04:40:00)
- gtoal
-
1000+ posts
Math Brain Teasers
7/2*10-10(100-2*5*4)
-565 or -599.65?-565
/ \
/ \
/ \
/ \
/ 600
/ / \
/ / 60
/ / / \
35 / / 40
/ \ / / / \
3.5 \ / / 10 \
/ \ \ / / / \ \
7 / 2 * 10 - 10 (100 - 2 * 5 * 4)
/ and * are at the same priority level and are handled left to right.
Hey, project idea: parse expressions and draw the parse tree….
Last edited by gtoal (Aug. 1, 2015 04:42:10)
- DigiTechs
-
500+ posts
Math Brain Teasers
7/2*10-10(100-2*5*4)
-565 or -599.65?-565
/ \
/ \
/ \
/ \
/ 600
/ / \
/ / 60
/ / / \
35 / / 40
/ \ / / / \
3.5 \ / / 10 \
/ \ \ / / / \ \
7 / 2 * 10 - 10 (100 - 2 * 5 * 4)
/ and * are at the same priority level and are handled left to right.
Hey, project idea: parse expressions and draw the parse tree….
That would be pretty easy assuming you didn't follow basic order of operation rules

I do, in fact, have my own site; it's here.
I'm also working on a thing called Fetch. Look at it here!
@thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain.
- gtoal
-
1000+ posts
Math Brain Teasers
Hey, project idea: parse expressions and draw the parse tree….
That would be pretty easy assuming you didn't follow basic order of operation rulesIt would still be pretty cool though.
Handling operator precedence is where the fun is in that project! It's not actually very hard, for example here's a really simple algorithm:
Let's assume that you have an expression parser which works, but assumes left to right associativity and does not understand operator precedence. This will allow you to trivially add parentheses to that expression so that it is fully parenthesised and therefore correctly reflects operator precedence. You can just about implement this with a macro-processor, even, or a trivial filter on input.
First, write down your operators in order of precedence:
^
* /
+ -
^ ") ^ ("
* / ")) * ((" and ")) / (("
+ - "))) + (((" and "))) - ((("
Before you copy any items from the input to the output, print a number of opening parentheses which is one larger than the largest string above i.e. “((((”
Take your input expression string one item at a time, from left to right.
For each item, if it is a terminal (eg a variable or a constant) just output it; if it is an operator, output the replacement string above.
Finally, output a matching set of closing parentheses, i.e. “))))”.
Let's take a test string, and apply this algorithm:
a*b+c^d/e
((((a
((((a)) * ((b
((((a)) * ((b))) + (((c) ^ (d)) / ((e
((((a)) * ((b))) + (((c) ^ (d)) / ((e))))
We can check this by manually removing redundant parentheses:
((((a)) * ((b))) + (((c) ^ (d)) / ((e))))
((( a ) * ( b )) + (( c ^ d ) / ( e )))
(( a * b ) + (( c ^ d ) / e ))
( a * b ) + (( c ^ d ) / e )
This algorithm is congruent with Dijkstra's “shunting yard” operator precedence algorithm; copying a “(” to the output before a terminal is equivalent to switching the tracks so that the next item is pushed on the stack, and outputting a “)” is the same as popping off the stack.
Here is some C code to parenthesise (but not evaluate) an expression:
#include <stdio.h>
char *intable[] = { NULL, "^", "*", "/", "+", "-", "" };
char *outtable[] = { "))))\n", ")^(", "))*((", "))/((", ")))+(((", ")))-(((", "((((" };
int main(int argc, char **argv)
{
int i, tab;
for (argv[i=0]=""; i <= argc; i++) {
for (tab = 0; tab < (sizeof(outtable)/sizeof(char *)); tab += 1) {
if ((!argv[i]) || (tab && !strcmp(argv[i], intable[tab]))) {
printf("%s", outtable[tab]); break;
} else if (tab && !*intable[tab]) printf("%s", argv[i]);
}
}
}
$ cc -o parenthesise parenthesise.c
$ ./parenthesise a \* b + c ^ d / e
((((a))*((b)))+(((c)^(d))/((e))))
Last edited by gtoal (Aug. 2, 2015 02:54:50)
- liam48D
-
1000+ posts
Math Brain Teasers
That is pretty awesome. Pretty awesome indeed.
202e-202e-202e-202e-202e UNI-CODE~~~~~
- liam48D
-
1000+ posts
Math Brain Teasers
Um, what does that have to do with brain teasers..?hello
Please try to keep your posts on-topc on the forums. Also, just so you know, don't post on things that haven/t been posted on for months (that's called necroposting) unless you have a really good thing to add to the discussion..
202e-202e-202e-202e-202e UNI-CODE~~~~~
- __init__
-
1000+ posts
Math Brain Teasers
This wasn't a necropost…Um, what does that have to do with brain teasers..?hello
Please try to keep your posts on-topc on the forums. Also, just so you know, don't post on things that haven/t been posted on for months (that's called necroposting) unless you have a really good thing to add to the discussion..
thisandagain pls explain
- liam48D
-
1000+ posts
Math Brain Teasers
I know but I assume they're new to the forums so I decided to tell them about necro-ing.This wasn't a necropost…Um, what does that have to do with brain teasers..?hello
Please try to keep your posts on-topc on the forums. Also, just so you know, don't post on things that haven/t been posted on for months (that's called necroposting) unless you have a really good thing to add to the discussion..
202e-202e-202e-202e-202e UNI-CODE~~~~~
- Discussion Forums
- » Advanced Topics
-
» Math Brain Teasers