Query Number of Loaded Posts in Loop

The literal implementation would be to:

  1. Create array variable
  2. While looping add to it ID of each post, using term name as key (so you have array of arrays)
  3. After main loop check the array and query additional posts if needed, using stored IDs for post__not_in so there are no duplicates

Syntax will be something like this:

$post_counts = array( 'learn' => array()  );

// append ID, $post_counts['learn'] will hold array of IDs
$post_counts['learn'][] = $post_id;

It might make sense however to rather loop through terms and retrieve six posts for each. It will not probably be significantly heavier computationally, but it will be simpler and easier to maintain logic.