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 »

Activity for south‭

Type On... Excerpt Status Date
Edit Post #286638 Initial revision over 2 years ago
Answer A: Make a frequency table (histogram)
J, 8 bytes ```J .,:#/. ``` Tacit function, this is the de facto method for this problem in J. Attempt it online!
(more)
over 2 years ago
Edit Post #286637 Initial revision over 2 years ago
Answer A: Make a frequency table (histogram)
Python 3, 38 36 33 bytes ```python lambda x:{n:x.count(n)for n in x} ``` -2 bytes thanks to @Razetime Another -3 bytes thanks to @orthoplex Attempt it online!
(more)
over 2 years ago
Comment Post #285638 Most times I explicitly state what type of submission it is as to avoid confusion.
(more)
over 2 years ago
Comment Post #285700 Thanks for that, a non-tacit solution is smarter.
(more)
over 2 years ago
Edit Post #285700 Post edited:
over 2 years ago
Comment Post #285638 Honestly, that's a good question. I had not thought of that. If I am reading [this](https://codegolf.codidact.com/posts/286366/286367#answer-286367) right, though, parens are not required.
(more)
over 2 years ago
Edit Post #285697 Post edited:
over 2 years ago
Edit Post #286383 Post edited:
Forgot to decrement the range
over 2 years ago
Edit Post #286383 Initial revision over 2 years ago
Answer A: Create a range grid
MATL, 8 bytes ``` tp:qwPe! ``` Try it online! ``` tp:qwPe! t : duplicate with implicit input (function args as array) p : product [2 3]p -> 6 : : range 1..n q : decrement w : swap top of stack P : flip [2 3]P -> [3 2] e : reshape 1 2 3...
(more)
over 2 years ago
Comment Post #286354 Ah, I see. Thanks.
(more)
over 2 years ago
Edit Post #286361 Initial revision over 2 years ago
Answer A: Create a range grid
Ruby, 33 bytes ``` ->n,m{[(0...nm).eachslice(m)]} ``` Try it online!
(more)
over 2 years ago
Comment Post #286354 Can the input be taken in as an array?
(more)
over 2 years ago
Edit Post #286327 Initial revision over 2 years ago
Answer A: The Pell Numbers
J, 28 bytes ``` :}.@{.m&(+/ .)&m=.2 1,:1 0 ``` [Try it online! Tacit matmul solve. `x&u&y` applies `x` to `y` `n` times.
(more)
over 2 years ago
Edit Post #286326 Initial revision over 2 years ago
Answer A: Looping counter
MATL, 16 bytes ``` 1`1yh1$lZctDwQt] ``` Try it online! The TIO output fetch will likely fail, so make sure to click the run button to stop the execution. ``` 1`1yh1$lZctDwQt] 1` ] - Push 1 onto stack, enter do-while 1 - Push 1 onto stack y - d...
(more)
over 2 years ago
Edit Post #286091 Initial revision over 2 years ago
Answer A: Determine whether an integer is square-free
MATL, 6 bytes ``` YftuX= ``` Try it online! Same method as Moshi. ``` YftuX= Yf - factor with implicit input t - duplicate u - unique X= - isequal ```
(more)
over 2 years ago
Edit Post #286089 Initial revision over 2 years ago
Answer A: Solve Goldbach's Conjecture
MATL, 19 bytes ``` XH:YqtZ!tsH=f1Z)Z) ``` Try it online! I'm still a novice at MATL, so I am all ears to any improvements. ``` XH:YqtZ!tsH=f1Z)Z) XH - copy implicit input to H clipboard : - range 1..n Yq - vectorized n-th prime t ...
(more)
over 2 years ago
Edit Post #286088 Initial revision over 2 years ago
Answer A: Are All Elements Equal?
MATL, 4 bytes ``` tPX= ``` Try it online! ``` tPX= t - duplicate with implicit input P - fliplr in MATLAB, reverses top of stack X= - isequal ```
(more)
over 2 years ago
Edit Post #286082 Initial revision over 2 years ago
Answer A: Can you give me half?
MATL, 3 distinct, 3 total ``` lH/ ``` Try it online! Computes `1/2`. Reserved labels for constants can be found here
(more)
over 2 years ago
Edit Post #286061 Initial revision over 2 years ago
Answer A: Solve Goldbach's Conjecture
Ruby, 69 bytes ```RUBY require'prime';->n{Prime.first(n).then{1.product 1}.find{1+2==n}} ``` Try it online!
(more)
over 2 years ago
Edit Post #286055 Initial revision over 2 years ago
Answer A: Solve Goldbach's Conjecture
J, 50 bytes ```J {{({[:y&(i.&1@:=)[:>+/&.>),{@(,&+/&.>),{@(,&+/&.>) NB. monadic hook [:>+/&.> NB. sum each pair and unbox [:y&(i.&1@:=) NB. first occurrence of y in list of sums { ...
(more)
over 2 years ago
Edit Post #286053 Initial revision over 2 years ago
Answer A: Keyword golfing
Ruby 3.1.0, 274 259 249 bytes -10 bytes thanks to Paradox in the Ruby discord ```ruby BEGIN{END{alias module class begin rescue retry ensure end if self elsif defined? for$.in true do super while false until 0unless not ENCODING and LINE or nil undef redo next end return def break =yiel...
(more)
over 2 years ago
Edit Post #285992 Initial revision almost 3 years ago
Answer A: Small integer swapping
J, 3 bytes ```J ,|. ``` Try it online! This hook `y f (g y)` appends `y` with its reverse.
(more)
almost 3 years ago
Edit Post #285963 Initial revision almost 3 years ago
Answer A: Determine whether an integer is square-free
J, 17 bytes ```J {{./y|:2+i.y}} ``` Try it online! A direct definition closest to Razetime's infuriatingly good train solution. Outputs a non-zero number for true and 0 for false.
(more)
almost 3 years ago
Edit Post #285955 Initial revision almost 3 years ago
Answer A: A number adder, not a death adder
J, 21 bytes ```J ,&'+".1!:1(3)'1!:1(3) ``` Try it online! STDIN is ugly in J because you have to use foreigns.
(more)
almost 3 years ago
Edit Post #285923 Initial revision almost 3 years ago
Answer A: Make my value binary
J, 2 bytes ```J #: ``` Try it online! Antibase two
(more)
almost 3 years ago
Edit Post #285922 Initial revision almost 3 years ago
Answer A: Shape of an array
J, 1 byte ```J $ ``` This is shape of. Pretty low-hanging fruit tbh.
(more)
almost 3 years ago
Comment Post #283972 [18 bytes](https://tio.run/##KypNqvz/v0DJIzUnJ19HQbk6PbWkuFZR6f//4vzSkgwA) use `p` instead of `puts`
(more)
almost 3 years ago
Edit Post #285903 Post edited:
almost 3 years ago
Comment Post #285903 Ah yes, I made an error there. Sorry, about that.
(more)
almost 3 years ago
Edit Post #285903 Post edited:
almost 3 years ago
Edit Post #285903 Initial revision almost 3 years ago
Answer A: Can you give me half?
J, 4 3 distinct, 6 bytes ```J -:-: ``` Half of ` -: ` which is asks if infinity matches infinity. Thanks to @xash in the APL farm discord for saving the 3 unique bytes and orthoplex for catching my blunder.
(more)
almost 3 years ago