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

60%
+1 −0
Challenges Determine whether an integer is square-free

BQN, 13 bytesSBCS ∧´0≠⊢|˜·×˜2+↕ Run online! A train submission. It's 2 bytes shorter than the lambda version {∧´0≠𝕩|˜×˜2+↕𝕩}, due to omitting curly braces. The idea is similar to ruby: ran...

posted 2y ago by Razetime‭

Answer
#1: Initial revision by user avatar Razetime‭ · 2022-01-08T04:15:26Z (about 2 years ago)
# [BQN](https://mlochbaum.github.io/BQN/), 13 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup>
```none
∧´0≠⊢|˜·×˜2+↕
```

[Run online!](https://mlochbaum.github.io/BQN/try.html#code=RiDihpAg4oinwrQw4omg4oqifMucwrfDl8ucMivihpUKCj7ii4jin5xGwqggMSvihpUxMA==)

A train submission. It's 2 bytes shorter than the lambda version `{∧´0≠𝕩|˜×˜2+↕𝕩}`, due to omitting curly braces.

The idea is similar to ruby:

- range 2..n+1
- square it, then modulo n
- are all remainders ≠ 0?