Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

71%
+3 −0
Challenges Prime Difference

Dyalog APL Extended, 14 bytes {¯4⍭4⍭⍣(⍵≤-)2} Try it online! {¯4⍭4⍭⍣(⍵≤-)2} Monadic dfn 2 start with 2 ⍣ Repeat 4⍭ the function "next prime" ...

posted 4y ago by dzaima‭

Answer
#1: Initial revision by user avatar dzaima‭ · 2020-11-14T17:58:42Z (about 4 years ago)
# [Dyalog APL Extended], 14 bytes

```apl
{¯4⍭4⍭⍣(⍵≤-)2}
```

[Try it online!][TIO-khhzn6dc]

```apl
{¯4⍭4⍭⍣(⍵≤-)2}  Monadic dfn
            2   start with 2
      ⍣         Repeat
    4⍭          the function "next prime"
       (⍵≤-)    until the difference from the previous one is ≥ the input
 ¯4⍭            previous prime of that
````


[Dyalog APL Extended]: https://github.com/abrudz/dyalog-apl-extended
[TIO-khhzn6dc]: https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn/P@1R24TqQ@tNHvWuBeFHvYs1HvVufdS5RFfTqPb/o76pQPm0Qyse9W62@A8A "APL (Dyalog Extended) – Try It Online"