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];
	}
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];
	}
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 ] ; }
returns the prime form of this PCS according to Ian Ring's algorithm.
Invented by Ian Ring, 2016
Proven in 2016 to produce idential results as the Rahn algorithm, but the method is less complicated.
returns the prime form of this PCS according to Ian Ring s algorithm . Invented by Ian Ring 2016 Proven in 2016 to produce idential results as the Rahn algorithm but the method is less complicated .