Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

typo fix
Source Link
Neil
  • 184.4k
  • 12
  • 76
  • 290

Retina 0.8.2, 53 bytes

^
;
+%`;(.)
1ドル;$'¶$`;
.+
$*
%A`^.?$|^(..+)1円+$
^1+¶+$

Try it online! Link includes test cases. Explanation:

^
;
+%`;(.)
1ドル;$'¶$`;

Generate all subsequences of the input.

.+
$*

Convert then to unary.

%A`^.?$|^(..+)1円+$

Delete the ones that arearen't prime, but don't delete the newlines. (A multiline replace also works, but is harder to format an explanation for.)

^1+¶+$

Check that the original input was prime but none of the proper subsequences were.

Retina 0.8.2, 53 bytes

^
;
+%`;(.)
1ドル;$'¶$`;
.+
$*
%A`^.?$|^(..+)1円+$
^1+¶+$

Try it online! Link includes test cases. Explanation:

^
;
+%`;(.)
1ドル;$'¶$`;

Generate all subsequences of the input.

.+
$*

Convert then to unary.

%A`^.?$|^(..+)1円+$

Delete the ones that are prime, but don't delete the newlines. (A multiline replace also works, but is harder to format an explanation for.)

^1+¶+$

Check that the original input was prime but none of the proper subsequences were.

Retina 0.8.2, 53 bytes

^
;
+%`;(.)
1ドル;$'¶$`;
.+
$*
%A`^.?$|^(..+)1円+$
^1+¶+$

Try it online! Link includes test cases. Explanation:

^
;
+%`;(.)
1ドル;$'¶$`;

Generate all subsequences of the input.

.+
$*

Convert then to unary.

%A`^.?$|^(..+)1円+$

Delete the ones that aren't prime, but don't delete the newlines. (A multiline replace also works, but is harder to format an explanation for.)

^1+¶+$

Check that the original input was prime but none of the proper subsequences were.

Source Link
Neil
  • 184.4k
  • 12
  • 76
  • 290

Retina 0.8.2, 53 bytes

^
;
+%`;(.)
1ドル;$'¶$`;
.+
$*
%A`^.?$|^(..+)1円+$
^1+¶+$

Try it online! Link includes test cases. Explanation:

^
;
+%`;(.)
1ドル;$'¶$`;

Generate all subsequences of the input.

.+
$*

Convert then to unary.

%A`^.?$|^(..+)1円+$

Delete the ones that are prime, but don't delete the newlines. (A multiline replace also works, but is harder to format an explanation for.)

^1+¶+$

Check that the original input was prime but none of the proper subsequences were.

AltStyle によって変換されたページ (->オリジナル) /