code: def _anderson_ksamp_right(samples, Z, Zstar, k, n, N):
      """
      Compute A2akN equation 6 of Scholz & Stephens.
  
      Parameters
      ----------
      samples : sequence of 1-D array_like
          Array of sample arrays.
      Z : array_like
          Sorted array of all observations.
      Zstar : array_like
          Sorted array of unique observations.
      k : int
          Number of samples.
      n : array_like
          Number of observations in each sample.
      N : int
          Total number of observations.
  
      Returns
      -------
      A2KN : float
          The A2KN statistics of Scholz and Stephens 1987.
      """
  
      A2kN = 0.0
      lj = Z.searchsorted(Zstar[:-1], "right") - Z.searchsorted(
          Zstar[:-1], "left"
      )
      Bj = lj.cumsum()
      for i in arange(0, k):
          s = np.sort(samples[i])
          Mij = s.searchsorted(Zstar[:-1], side="right")
          inner = (
              lj
              / float(N)
              * (N * Mij - Bj * n[i]) ** 2
              / (Bj * (N - Bj))
          )
          A2kN += inner.sum() / n[i]
      return A2kN
  
imports: from __future__ import division, print_function, absolute_import
  import math
  import warnings
  from collections import namedtuple
  import numpy
  from numpy import isscalar, r_, log, around, unique, asarray, zeros, arange, sort, amin, amax, any, atleast_1d, sqrt, ceil, floor, array, compress, pi, exp, ravel, count_nonzero, sin, cos, arctan2, hypot
  from scipy._lib.six import string_types
  from scipy import optimize
  from scipy import special
  from .None import statlib
  from .None import stats
  from .stats import find_repeats, _contains_nan
  from .contingency import chi2_contingency
  from .None import distributions
  from ._distn_infrastructure import rv_generic
label_desc: Use image node_id 25 for calling a global function with example usage: _anderson_ksamp_right(samples, Z, Zstar, k, n, N) and returns: A2kN