GMAT IR: Numerical Algorithm Flowchart Problems

Numerical Algorithm Flowchart Problems - image by Magoosh
On the GMAT Integrated Reasoning, one of the four types of questions formats is Graphic Interpretation.  One of the many kinds of graphs you could see on this question type is a flowchart.  Many flowcharts will be more verbal in nature, but they GMAT could slip you a flowchart representing a numerical algorithm — that is to say, a complicated procedure, spelled out in step-by-step format.  To start, here’s an example of such a question.



The flowchart represents a mathematical algorithm that takes one positive integer as the input and returns a positive integer as the output.  Processes are indicated in the rectangular symbols in the flowchart.  Each process is represented by an equation, such as p = p + 1.  In this particular process, one is added to the current value of p, and the sum becomes the new value of p.  For example, if p = 8 before the process, p = 9 after the process.


Question #1

1a) A value p = 50 is initially entered.  When S first has a value of S = 10, p has a value of _____________.


(On the real GMAT, this little “answer chart” would be a drop-down menu in the blank spot of the question!)

1b) An initial entry that reaches an output in the fewest number of steps is ________.


Improve your GMAT score with Magoosh.

A full solution will follow this article.


Making sense of this

For mathematical and computer science folks, a flowchart diagraming a mathematical algorithm might be one of the most enjoyable games the GMAT provides.  For less mathy folks, though, this questions type could be a living nightmare.  How does someone not adroit at mathematical reasoning even begin to make sense of this?

Notice for the first question, and often for the first question on such a problem, all the question is asking us is to plug in an initial value and follow it step-by-step through the process.  From what I can tell, this is standard on the GMAT: if the mathematical algorithm involves more than a couple steps, then the first of the two question will simple be of the form — “Here are the plug-in numbers: can you follow the step-by-step process a couple steps?” Don’t be intimidated.  All you have to do is follow the arrows, one step at a time, and keep track of what each variable equals at each point.

Sometimes the other question also involves plugging in some input, perhaps going a few more steps ahead.  Sometimes, though, the other question, like the second question here, involves no so much plugging in a bunch of different numbers, but getting a sense of the patterns.  For example, particular loops that repeat several times are very important patterns to notice —- why they repeat, and what changes on each repetition.  I will discuss this more for this particular flowchart in the solutions below.

Keep in mind that the actual math involve will just be ordinary arithmetic.  Keep in mind that every individual step is something you are most certainly able to do.  The biggest challenge, in many ways, is simply keeping all the information organized.  I will show how I do this in the solution below.



If the discussion above gave you any insights or “aha’s”, you may want to take another look at what those questions are asking.  If you would like to share anything or ask a question, please let us know in the comments section below.


Practice Question Explanation

1) OVERVIEW: Without plugging in any particular number, I am going to just follow the process step-by-step and see what I notice.

At the start, S = 12, and p can be any number I enter.  The first thing that happens is the question: is p even or odd?  If it’s even, we add one, making it odd.  The only other place in the entire charge where p can change is the “p = p + 2” box — once p is odd, adding 2 will just produce another odd number, so what happens to p — if it’s even, it is made odd, and once it’s odd, it just moves up by 2, through the odd numbers consecutively.

If p is not prime, the number simply repeats that upper loop — not prime, add 2, is it even? no, not prime, repeat.  While going around that loop, S doesn’t change.  The only opportunity for S to change is if p is a prime number.

What happens when p gets to an odd value?  Then we move down to the decision diamond “Is p < S?”  That’s a crucial place.  Since S only starts at 12, most of the time, the answer will be no, S will decrease by one, and if it’s not zero, it returns to that same upper loop.  Thus, usually, S decrease by one every time p hits a prime number, so p will keep rising until it hits its twelfth prime number value.

BUT, if the input is small, and p actually is smaller than S, then S decrease by p — that is to say, S decreases not just by one but by several notches all at once: the process accelerates significantly, and it will take far fewer steps to complete the entire process.

Notice, also, the output, the final value of p, will have to be prime number, because the only way that we break out of that upper loop and get to the lower half of the flowchart is when p is prime.  The output is always prime.

Those are all the things I notice just scanning the flowchart, without plugging anything in.

Question 1a) I will use ordered pairs of the form (p, S) to discuss this.  I recommend ordered pairs (or triplets) for keeping track of how numbers change as we move through the steps.

Enter p = 50, so at that point we are at (50, 12).  Is p even? Yes, so add one: (51, 12).  Is p prime? No (51 = 3*17), so we go around the upper loop — add two to p: (53, 12), then p is odd, and now, 53 is in fact prime.

Improve your GMAT score with Magoosh.

Drop down to the lower decision dimension: p = 53 is not less than S = 12, so subtract one from S: (53, 11).  We see S is not zero, so back up to the upper loop.  Add two to p: (55, 11).  Is p even? No.  Is p prime? No (55 = 5*11).  Around the upper loop.  Add two to p: (57, 11).  Is p even? No.  Is p prime? No (57 = 3*19).  Around the upper loop.  Add two to p: (59, 11).  Is p even? No.  Is p prime? Yes, 59 is in fact prime.

Again, drop down Drop down to the lower decision dimension: of course, p = 59 is not less than S = 11, so subtract one from S: (59, 10). That’s it.  S now has a value of 10, so the value of p at this point is p = 59.  That’s the answer. (D) 59

Question 1b)  Here, the analysis we did above really helps us.  For most numbers, larger numbers, S will decrease one notch at a time, and we will have to move p through twelve different prime numbers to reach an output.  BUT, if we can have a p get down to the lower half that’s less than S = 12, then we can reduce S by a whole lot at once, and vastly accelerate the process.

Reject p =31 — too big.  Even p = 12 will not work: that’s even, so immediately, it will be nudged up to p = 13 at the very beginning, and then it’s already bigger than S.  That doesn’t work.

Suppose we start with p = 10.  Also even, so immediately it nudges up to p = 11, which is prime.  That would go to the lower loop, and in one fell swoop, S would go down from S = 12 to S = 1!  WOW!  That’s huge!  That means there would only one more trip around the upper loop, p goes up to p = 13, also prime, back to the lower half, S goes to zero, and the process outputs p = 13 and is done.  That’s a lightning fast conclusion! It only goes all the way around that upper loop once!

The smaller starting values, p = 1 (which is NOT prime) and p = 3 will require more than two circuits in the upper loop, so they will take more steps.  Of these five answers, nothing else would reach an output as quickly as p = 10.  (C) 10


Ready to get an awesome GMAT score? Start here.

Most Popular Resources


  • Mike MᶜGarry

    Mike served as a GMAT Expert at Magoosh, helping create hundreds of lesson videos and practice questions to help guide GMAT students to success. He was also featured as "member of the month" for over two years at GMAT Club. Mike holds an A.B. in Physics (graduating magna cum laude) and an M.T.S. in Religions of the World, both from Harvard. Beyond standardized testing, Mike has over 20 years of both private and public high school teaching experience specializing in math and physics. In his free time, Mike likes smashing foosballs into orbit, and despite having no obvious cranial deficiency, he insists on rooting for the NY Mets. Learn more about the GMAT through Mike's Youtube video explanations and resources like What is a Good GMAT Score? and the GMAT Diagnostic Test.

More from Magoosh