これは大きなプログラムではありません。各行は、プライムチェックに取り組むための独立した代替プログラムです(プライム組み込みを使用せずに)。
ÑPQ
ÒgΘ
ÒQP
ÕαΘ
fQO
fs¢
f`Q
Grimyのおかげで-2バイト。
行間の空白は05AB1Eではノーオペレーションであり、1バイトのコマンドのみを使用しているため、これは転置後に正常に機能します。
出力1
/ 0
truthy / falseyそれぞれのために。
オンライン最初のものを試してみたり(evalの組み込みと、それらのすべてのためにいくつかのより多くのテストケースを検証します.V
)。
転置:最初の1つをオンラインで試してください。
説明:
Ñ # Get a list of all divisors of the (implicit) input-integer
# (which would be only 1 and the integer itself for primes)
P # Take the product of that list
Q # And check if it's equal to the (implicit) input-integer
Ò # Get a list of all prime factors of the (implicit) input-integer
g # Get the amount of those prime factors by taking the length of the list
Θ # Check if that's equal to 1 (so only itself is a prime factor)
Ò # Get a list of all prime factors of the (implicit) input-integer including duplicates
Q # Check for each if it's equal to the (implicit) input-integer
# (1 if truthy; 0 if falsey)
P # Take the product of those checks (resulting in either 1 or 0 as well)
Õ # Get the Euler totient of the (implicit) input-integer
α # Take the absolute difference with the (implicit) input-integer
Θ # Check if that's equal to 1
f # Get a list of all prime factors of the (implicit) input-integer without duplicates
Q # Check for each if it's equal to the (implicit) input-integer
O # And take the sum of that (resulting in either 1 or 0)
f # Get a list of all prime factors of the (implicit) input-integer without duplicates
s # Swap to get the (implicit) input-integer
¢ # And count how many time it occurs in the list
f # Get a list of all prime factors of the (implicit) input-integer without duplicates
` # Dump all the content of this list onto the stack
Q # Check if the top two values are equal, or if only a single value is present, it will
# use the (implicit) input-integer as second value
# For all these program the same applies at the end:
# (implicitly output the result with trailing newline)
注:のみtruthy / falsey値が有効である場合は、それが必要なのいずれかで、別個のものでなければならないÒg
かÕα
だけであるため、有効な2-bytersとして使用することができ1
05AB1Eにtruthyあり、そして他のすべてがfalseyです:の両方を試してみてくださいいくつかのテストケースのためにそれら。
組み込みコマンドが許可された場合は、シングルはp
足りているだろう:オンラインそれを試してみてくださいまたはいくつかのより多くのテストケースを検証します。