After painting the red and blue pebbles, Shawn had a remainder of 40 - 9 - 13 = <<40-9-13=18>>18 pebbles.

He painted 18/3 = <<18/3=6>>6 pebbles yellow.

The difference between the number of blue and yellow pebbles is 13 - 6 = <<13-6=7>>7.

# Answer

7
<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
Shawn collected 40 plain pebbles. He painted 9 pebbles red and 13 pebbles blue. He then divided the remaining pebbles equally into 3 groups, and painted them purple, yellow, and green. What is the difference between the number of blue and yellow pebbles?
Please reason step by step, and put your final answer within \boxed{{}}.<|im_end|>
<|im_start|>assistant

user
7
Shawn collected 40 plain pebbles. He painted 9 pebbles red and 13 pebbles blue. He then divided the remaining pebbles equally into 3 groups, and painted them purple, yellow, and green. What is the difference between the number of blue and yellow pebbles?
train