Generate Optimus numbers.

@param  int  $times
@param  int  $prime
@return array
770034
protected function generateOptimusNumbers($times = 1, $prime = null)
    {
        $prime = $prime ?: null;

        $result = [];
        for ($i = 0; $i < $times; $i++) {
            $result[] = Energon::generate($prime);
        }

        return $result;
    }
783860
public function primeFormRing() {
		// shortcut
		if ($this->bits == 0) {
			return 0;
		}

		$bits = \ianring\BitmaskUtils::moveDownToRootForm($this->bits);

		$rotations = array();

		$count = \ianring\BitmaskUtils::countOnBits($bits);
		if ($count == 1) {
			return $bits;
		}

		for ($i=0; $i<$count; $i++) {
			$rotations[] = $bits;
			$tones = \ianring\BitmaskUtils::bits2Tones($bits);
			$first = $tones[1];
			$bits = \ianring\BitmaskUtils::rotateBitmask($bits, 1, $first);
		}

		$bits = \ianring\BitmaskUtils::moveDownToRootForm(\ianring\BitmaskUtils::reflectBitmask($this->bits));

		for ($i=0; $i<$count; $i++) {
			$rotations[] = $bits;
			$tones = \ianring\BitmaskUtils::bits2Tones($bits);
			$first = $tones[1];
			$bits = \ianring\BitmaskUtils::rotateBitmask($bits, 1, $first);
		}

		usort($rotations, function($a, $b) {
			return $a > $b;
		});
		return $rotations[0];
	}
1331854
public static function secondsToTime($inputSeconds) {
        $secondsInAMinute = 60;
        $secondsInAnHour = 60 * $secondsInAMinute;
        $secondsInADay = 24 * $secondsInAnHour;
        $secondsInAMonth = 30 * $secondsInADay;
        $secondsInAYear = 12 * $secondsInAMonth;

        $years = floor($inputSeconds / $secondsInAYear);

        $monthSeconds = $inputSeconds % $secondsInAYear;
        $months = floor($monthSeconds / $secondsInAMonth);

        $daySeconds = $monthSeconds % $secondsInAMonth;
        $days = floor($daySeconds / $secondsInADay);

        $hourSeconds = $daySeconds % $secondsInADay;
        $hours = floor($hourSeconds / $secondsInAnHour);

        $minuteSeconds = $hourSeconds % $secondsInAnHour;
        $minutes = floor($minuteSeconds / $secondsInAMinute);

        $remainingSeconds = $minuteSeconds % $secondsInAMinute;
        $seconds = ceil($remainingSeconds);

        $aReturn = array(
            'y' => (int) $years,
            'm' => (int) $months,
            'd' => (int) $days,
            'h' => (int) $hours,
            'i' => (int) $minutes,
            's' => (int) $seconds
        );
        return $aReturn;
    }
1215853
public function times($times = null)
    {
        // API compat with mockery
        if ($this->atLeastWasCalled && $times !== null) {
            $this->atLeastWasCalled = false;
            $this->atLeast($times);
        } elseif ($times !== null) {
            if ($times === 0) {
                $this->never();
            } else {
                // normal operation
                $count = 0;
                $this->expectation->setPostPerformCallback(function() use (&$count, $times){
                    $count++;
                    $this->commentBuilder->incrementCallCount();
                    if ($count === $times) {
                        $this->expectation->setSatisfied(true);
                        $this->expectation->setPerformCallback(function($name, $args) use ($times) {
                            $message = "Unexpected call to {$this->methodName}";

                            if (count($args)) {
                                $message .= " with " . Util::printArray($args);
                            }

                            $message .= " - already called $times times";

                            throw new UnexpectedCallException($message);
                        });
                    }
                });

                $this->commentBuilder->setTimes($times);
                $this->commentBuilder->setAtLeast(false);
            }
        }
        
        return $this;
    }
447924
protected function parseFloatTime($time)
	{
		$result = array();
		array_push($result, fmod($time, 60));
		$time = intval($time / 60);
		array_push($result, fmod($time, 60));
		$time = intval($time / 60);
		array_push($result, fmod($time, 60));
		return array_reverse($result);
	}
123816
public function setMetricFactor($times)
  {
    if (ThrottlerHelper::validateMetricFactor($times)
        && !$this->isActive())
    {
      $this->metricFactor = $times;
      return true;
    }
    return false;
  }
859302
private function calculateSubKeys(array $matches = [], $amount, $times = 2)
    {
        if (empty($matches)) {
            return;
        }

        $j = $times;

        for ($i = 0; $i < $amount; $i++) {
            $var[] = "[\"{$matches[$j]}\"]";

            $j += $times;
        }

        return "\${$matches[1]}" . join(null, $var);
    }
1087345
public function process($process, $params, $index, $times)
    {
        self::$counts['p'] += count($process);
        self::$time['p'] += array_sum($times);
        $this->statistics();

        $hasParams = !empty($params);
        $params    = var_export($params, true);

        $details = [];
        foreach ($process as $_index => $rule) {
            if ($rule[0] instanceof Closure) {
                if ($hasParams) {
                    $detail = "Closure with parameters: $params; ";
                } else {
                    $detail = "Closure; ";
                }

            } else {
                $detail = $rule[0] . '::' . $rule[1] . '()';
            }

            if ($_index <= $index) {
                $detail .= $this->getSubInfo($times[$_index], '; success');
            } else {
                $detail .= $this->getSubInfo(0, '; <font style="color:red">failure</font>');
            }
            $details[$_index] = $detail;
        }
        $this->Debug->set('执行明细', $details);

    }
1228592
function getPrimes(limit) {
    var sieve = new Array(limit);
    var n, j, k;
    var last = Math.floor(Math.sqrt(limit));
    for (n=2; n < limit; n++) {
        sieve[n] = true;
    }
    for (n=2; n <= last;) {
        for (j= n+n; j < limit; j += n) {
            sieve[j] = false;
        }
        for (j=1; j < last; j++) {
            k = n+j;
            if (sieve[k]) {
                n = k;
                break;
            }
        }
    }
    var primes = [];
    for (n=2; n < limit; n++) {
        if (sieve[n]) {
            primes.push(n);
        }
    }
    return primes;
}
870838
public function getSitesIdFromTimezones($timezones)
    {
        Piwik::checkUserHasSuperUserAccess();

        $timezones = Piwik::getArrayFromApiParameter($timezones);
        $timezones = array_unique($timezones);

        $ids = $this->getModel()->getSitesFromTimezones($timezones);

        $return = array();
        foreach ($ids as $id) {
            $return[] = $id['idsite'];
        }

        return $return;
    }
751024
public static function repeat($data, int $times): Arrayy
    {
        if ($times === 0 || empty($data)) {
            return Arrayy::create();
        }

        return Arrayy::create(\array_fill(0, $times, $data));
    }
635288
private Number addTimes(Object n, Number toAdd, int times)
    {
        Number m = (Number)n;
        if (m instanceof Double)
        {
            return m.doubleValue() + times * toAdd.doubleValue();
        }
        return m.intValue() + times * toAdd.intValue();
    }
555307
def primes(n):
    
    if n==2:
        return [2]
    elif n<2:
        return []
    s=list(range(3,n+1,2))
    mroot = n ** 0.5
    half=(n+1)//2-1
    i=0
    m=3
    while m <= mroot:
        if s[i]:
            j=(m*m-3)//2
            s[j]=0
            while j<half:
                s[j]=0
                j+=m
        i=i+1
        m=2*i+3
    return [2]+[x for x in s if x]
889510
private function humpToLine($str,$times=1){
        if(preg_match_all('/[A-Z]/',$str) >= $times){
            $str = preg_replace_callback('/([A-Z]{1})/',function($matches){
                return '_'.strtolower($matches[0]);
            },$str);
            if($str[0]=='_'){
                $str = substr_replace($str,'',0,1);
            }
            return $str;
        }
        return $str;
    }
936251
public function negative($prime = true) {
		$negative = 4095 ^ $this->scale;
		$scale = new \ianring\Scale($negative);
		if ($prime) {
			return $scale->primeForm();
		}
		return $scale->scale;
	}
485518
public static function pj_enfn($es)
    {
        $en = array();
        $en[0] = static::C00 - $es * (static::C02 + $es * (static::C04 + $es * (static::C06 + $es * static::C08)));
        $en[1] = $es * (static::C22 - $es * (static::C04 + $es * (static::C06 + $es * static::C08)));
        $t = $es * $es;
        $en[2] = $t * (static::C44 - $es * (static::C46 + $es * static::C48));
        $t *= $es;
        $en[3] = $t * (static::C66 - $es * static::C68);
        $en[4] = $t * $es * static::C88;

        return $en;
    }
383264
def prime_gen() -> int:
    # credit to David Eppstein, Wolfgang Beneicke, Paul Hofstra
    
    D = {}
    yield 2
    for q in itertools.islice(itertools.count(3), 0, None, 2):
        p = D.pop(q, None)
        if p is None:
            D[q * q] = 2 * q
            yield q
        else:
            x = p + q
            while x in D:
                x += p
            D[x] = p