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 »

Posts by user‭

68 posts
81%
+7 −0
Challenges Reduce over the range [1..n]

Task I often need to find the factorial of a number or the sum of all numbers up to a number when cheating on math tests. To help me with this, your task is to write $F$, a generalized version of ...

14 answers  ·  posted 2y ago by user‭  ·  last activity 1y ago by gifti‭

81%
+7 −0
80%
+6 −0
Challenges Golf a FRACTRAN interpreter

APL (Dyalog Unicode), 33 bytes {×x←⊃(2⌷⍵)(÷⍨(/⍨)0=|)⍺×1⌷⍵:x∇⍵⋄⍺} Try it online! The first case doesn't work because it gets really big, but the other two do. The input is taken on the left a...

posted 3y ago by user‭  ·  edited 3y ago by user‭

Answer
77%
+5 −0
Challenges Shuffle a subset of a list

Idea shamelessly stolen from caird and rak1507 Shuffle a subset of a list of unique, positive integers with uniform randomness, given the indices of that subset. For example, given the list $[A, B...

4 answers  ·  posted 3y ago by user‭  ·  edited 2y ago by General Sebast1an‭

77%
+5 −0
Challenges Coat of Many Colours

Scala, 119 bytes Saved 26 bytes after porting Moshi's solution! _ sortBy("y gree br sc bla oc pe rub ol v f li go ch m cre c s ro a l ru g pu w p o b"split " "indexWhere _.startsWith) Original...

posted 2y ago by user‭  ·  edited 2y ago by user‭

Answer
77%
+5 −0
Challenges Juggler sequences

Scala, 78 67 64 bytes Saved 3 bytes thanks to Razetime Stream.iterate(_)(x=>math.pow(x,x%2+.5).toInt).takeWhile(_>1):+1 Try it in Scastie! Stream.iterate(_) //Make an infinite list by r...

posted 3y ago by user‭  ·  edited 3y ago by user‭

Answer
75%
+4 −0
Challenges Are they abundant, deficient or perfect?

APL (Dyalog Unicode), 21 bytes {×⍵-+/∪⍵∨¯1↓⍳⍵}¨∘⍳⊢⌸⍳ Try it online! Returns a matrix (padded with zeroes) where the first row is deficient numbers, the second is perfect numbers, and the thi...

posted 3y ago by user‭  ·  edited 3y ago by user‭

Answer
75%
+4 −0
Challenges Are they abundant, deficient or perfect?

Vyxal, 30 28 25 bytes Saved 1 4 bytes thanks to Aaron Miller ƛ∆K-±";£kɽƛ¥D„£_'t¥=;vṪ,£ Try it Online! A rather pitiful answer, but hey, it works. Gives deficient numbers, then perfect numbers...

posted 3y ago by user‭  ·  edited 3y ago by user‭

Answer
75%
+4 −0
Challenges Evens or Odds - you know this one

Scala -language:postfixOps, 2 bytes 1& Try it online! 1 for odd, 0 for even. Scala, 3 bytes _%2 Try it online! 1 for odd, 0 for even.

posted 3y ago by user‭

Answer
75%
+4 −0
Challenges Versatile self-printer

Scala 3 and Python 3.8 (pre-release), 2 languages (385 bytes) def String():Any=0 def Int():Any=0 def f(s:String):Any=print(s.replace(chr(81),chr(34)*3+s+chr(34)*3)) class M: f("""def Strin...

posted 3y ago by user‭  ·  edited 2y ago by General Sebast1an‭

Answer
75%
+4 −0
Challenges Partial Sums of Harmonic Series

Scala, 55 bytes (Stream from 1 map 1.0./scanLeft.0)(_+_)indexWhere _.<= Try it online! Written in a more sane manner: n => Stream.from(1).map(1.0/_).scanLeft(0.0)(_+_).indexWhere(_ &g...

posted 3y ago by user‭

Answer
75%
+4 −0
Meta Answering challenges with languages newer than the challenge

Answering with languages newer than the challenge should absolutely be allowed Most of the time, when a language is newer than a challenge, it's just a coincidence. By not allowing people to answe...

posted 2y ago by user‭

Answer
75%
+4 −0
Meta Reactions on Code Golf Codidact

I think "Dangerous" could perhaps stay on. "Outdated" would probably be better off replaced with "Invalid" or something of that sort. I don't think we need "Works for me" or an analog of it at all:...

posted 2y ago by user‭

Answer
75%
+4 −0
Challenges Make my number a set

APL (ngn/apl), 6 bytes {∇¨⍳⍵} Try it online! Dyalog APL and dzaima/APL appear to not give empty vectors for ⍳0, so I used ngn/APL. I don't know how to turn on boxing there, though, so there'...

posted 3y ago by user‭

Answer
75%
+4 −0
Challenges Output 256 in many different ways

Scala (-language:postfixOps), 4 solutions 1. Just 256: 256 2. Casting a character: +'Ā' The character Ā is 256 in decimal, and the unary + turns it into an Int. 3. Hashcode of a string: ...

posted 3y ago by user‭  ·  edited 3y ago by user‭

Answer
75%
+4 −0
Meta Should [code-golf-tips] be replaced with [tips] + [code-golf]?

Instead of the code-golf-tips tag, could we tag "Tips for golfing" questions with tips and code-golf instead? They can still be searched for, so I don't see a reason to make a special tag to repres...

1 answer  ·  posted 2y ago by user‭  ·  edited 2y ago by General Sebast1an‭

Question discussion tags
75%
+4 −0
Challenges Find n Niven Numbers

Scala, 52 bytes Stream.from(1).filter(x=>x%(x+"":\0)(_+_-48)<1).take Try it in Scastie! Woo, 3 deprecation warnings! (okay, one of them could be fixed but I like to live dangerously) St...

posted 1y ago by user‭  ·  edited 1y ago by user‭

Answer
71%
+3 −0
Challenges Determine whether an integer is square-free

Scala, 41 bytes x=>2 to x forall(d=>x%d+math.sqrt(d)%1>0) Try it online! Pretty straightforward

posted 2y ago by user‭

Answer
71%
+3 −0
Challenges Make my number a set

Japt, 3 bytes ÆßX Try it online! (don't mind the -Q This is Shaggy's solution. ÆßX Æ Make a range [0, input) and map each number X: ß Run this program again on X Japt, 11 8 bytes ...

posted 3y ago by user‭  ·  edited 3y ago by user‭

Answer
71%
+3 −0
Challenges Compute the determinant

Python 3.8 (pre-release), 106 95 bytes Saved 11 bytes thanks to Peter Taylor! f=lambda m:sum((-1)**i*x*f([r[:i]+r[i+1:]for r in m[1:]])for i,x in enumerate(m[0]))if m else 1 Try it online! ...

posted 2y ago by user‭  ·  edited 2y ago by user‭

Answer
71%
+3 −0
Sandbox Obligatory factorial challenge

posted 2y ago by user‭  ·  edited 2y ago by user‭

71%
+3 −0
Challenges It's Hip to be Square

Prolog (SWI), 42 bytes R-S:-S is R*R;R<S,M is R+1,M-S. f(S):-0-S. Try it online!

posted 2y ago by user‭

Answer
71%
+3 −0
Challenges It's Hip to be Square

Japt, 6 3 bytes Cut in half thanks to Shaggy! ¬v1 Try it online! Golfed thanks to Shaggy's interpreter auto-golf feature. ¬v1 ¬ //Square root v1 //Is that an integer?

posted 2y ago by user‭  ·  edited 2y ago by Shaggy‭

Answer
71%
+3 −0
Sandbox Shuffle a subset of a list [FINALIZED]

posted 3y ago by user‭  ·  edited 10mo ago by trichoplax‭

71%
+3 −0
Challenges Reverse an ASCII string

Scala, 9 bytes _.reverse Try it in Scastie! Explanation: _.reverse _ //The function argument . //Call a method reverse //Reverse the string

posted 3y ago by user‭

Answer