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 Revisions

2 of 2
typo fix
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 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.

Neil
  • 184.4k
  • 12
  • 76
  • 290

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