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

4 Responses to GMAT IR: Numerical Algorithm Flowchart Problems

  1. Claire August 15, 2016 at 10:11 pm #

    Hi Mike,

    Thanks for posting so many practices questions with detailed answers!

    I had the same question as Bo about the first value of S=10- I actually ended up trying to decrease S from 10 to 0 and ended the loop (such a LONG process!). It’s kinda confusing how it’s worded here haha.

  2. Shalin December 14, 2015 at 3:13 am #

    You can find some more interesting flowchart example diagrams in creately diagram community. These questions are very interesting

  3. Bo March 31, 2014 at 12:06 pm #

    After doing the problems, I believe the instruction for Q1 is misleading and the part where S=12 is wrong. First, saying that “S first has a value of 10” implies that in the chart, we start out with S=10 instead of S=12. And second, it cannot be S=12, because that would require multiple minus 1 before we get down to S=0. Both the answers for Q1 and Q2 indicate that S should be 2, so that we can go from P=57 at S-1 to P=59 at S=0, and from S=2 to S=1 in one fell swoop, and then go around the diagram once more before S=0 and we make it out at P=13.

    • Mike MᶜGarry
      Mike March 31, 2014 at 12:48 pm #

      Dear Bo,
      I believe you misunderstand. Of course, the system starts with S = 12. I said, “When S first has a value of S = 10, …” to indicate a later time when S would decline to S = 10. The value of S declines by 1 each time there is a prime number greater than S. I think you are also interpreting the instruction boxes incorrectly. The box “S = S – 1” means that, every time the system arrives at that box, we will subtract 1 from the value of S. Thus, the value of S naturally declines as we move through the loop successive times.
      Does all this make sense?
      Mike 🙂

Magoosh blog comment policy: To create the best experience for our readers, we will only approve comments that are relevant to the article, general enough to be helpful to other students, concise, and well-written! 😄 Due to the high volume of comments across all of our blogs, we cannot promise that all comments will receive responses from our instructors.

We highly encourage students to help each other out and respond to other students' comments if you can!

If you are a Premium Magoosh student and would like more personalized service from our instructors, you can use the Help tab on the Magoosh dashboard. Thanks!

Leave a Reply