code: def n_digit_freqs(digits, n, normalize=False):
      """
      Consume digits of pi and compute n digits freq. counts.
  
      This should only be used for 1-6 digits.
      """
      freqs = np.zeros(pow(10, n), dtype="i4")
      current = np.zeros(n, dtype=int)
      for i in range(n):
          current[i] = next(digits)
      for d in digits:
          index = int("".join(map(str, current)))
          freqs[index] += 1
          current[0:-1] = current[1:]
          current[-1] = d
      if normalize:
          freqs = freqs / freqs.sum()
      return freqs
  
file_path: ipyparallel/examples/pi/pidigits.py
imports: import os
  from urllib.request import urlretrieve
  import numpy
  from matplotlib import pyplot
label_desc: Use image node_id 9 for calling a global function with example usage: n_digit_freqs(digits, n, normalize) and returns: freqs