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 CrSb0001‭

20 posts
71%
+3 −0
Q&A Tips for golfing in Lean

Lean is an interactive theorem prover and a functional programming language created in 2013. What tips do you have for golfing in Lean? Tips should be specific to Lean ("remove comments" is not an...

0 answers  ·  posted 16d ago by CrSb0001‭

Question code-golf tips
66%
+2 −0
Challenges Give the fool's fibonacci sequence

Lean 4, 115 109 104 89 bytes Note: had to update bytecount to take into account non-printable characters. For anyone who isn't familiar with Lean, it's basically an interactive theorem prover t...

posted 16d ago by CrSb0001‭  ·  edited 12d ago by CrSb0001‭

Answer
66%
+2 −0
Q&A Tips for golfing in Emmental

Also posted here on CodeGolf.SE Brief introduction to Emmental: Emmental is a self-modifying programming language defined by a meta-circular interpreter. It is a stack based language, but also ...

0 answers  ·  posted 12mo ago by CrSb0001‭

Question code-golf tips
60%
+1 −0
Challenges Give the fool's fibonacci sequence

Python 3, 131 75 62 bytes f=lambda n:n>0and 2+3*f(n-1)+4*f(n-2)+2*sum(map(f,range(n-2))) I know, a one-liner is boring. This is because I apparently didn't need a separate function/lambda to...

posted 18d ago by CrSb0001‭  ·  edited 16d ago by CrSb0001‭

Answer
60%
+1 −0
Challenges Caesar shift cipher

Python 3, 86 85 bytes The reasoning behind why this works is basically that 1. we can directly compare the ordinal values of characters (apparently) and 2. we only need that if a character is alph...

posted 2d ago by CrSb0001‭  ·  edited 1d ago by CrSb0001‭

Answer
60%
+1 −0
Challenges Cumulative Counts

Lean 4, 111 bytes def c(l:List Nat):List Nat:=((λx=>((l.reverse).drop x).count (l.reverse)[x]!)<$>(List.range l.length)).reverse Try it online! Given how verbose Lean syntax is, and h...

posted 11d ago by CrSb0001‭  ·  edited 11d ago by CrSb0001‭

Answer
60%
+1 −0
Challenges Cumulative Counts

Python 3, 50 bytes We can simply omit the lambda name since we don't refer to it anywhere in the lambda definition. lambda l:[l[:i+1].count(j)for i,j in enumerate(l)] Example usage in the term...

posted 12d ago by CrSb0001‭

Answer
60%
+1 −0
Challenges Caesar shift cipher

Lean 4, 183 181 bytes def c(t:String)(s:Nat):String:=t.map (λc=>if Char.isAlpha c then let b:=if Char.isLower c then 'a'else 'A';let h:=(Char.toNat c-Char.toNat b+s)%26+Char.toNat b;Char.ofNat ...

posted 14d ago by CrSb0001‭  ·  edited 9d ago by CrSb0001‭

Answer
60%
+1 −0
Challenges Convert to Hexadecimal

Lean 4, 103 100 95 83 bytes def h:=λi=>if i<16then s!"{"0123456789ABCDEF".get ⟨i⟩}"else h (i/16)++h (i%16) Try it online! I actually am not sure how this even works, lol. I had thought...

posted 15d ago by CrSb0001‭  ·  edited 9d ago by CrSb0001‭

Answer
60%
+1 −0
Challenges Ratio limits of fibonacci-like series

Python 3, 26 bytes lambda n:(n+(n*n+4)**.5)/2 We can actually just compute this directly, although I could have taken an alternate path considering the fact that, given $R_n$ as the ratio betwe...

posted 18d ago by CrSb0001‭  ·  edited 9d ago by CrSb0001‭

Answer
60%
+1 −0
Challenges "Hello, World!"

Emmental, 51 bytes #72.#101.#108::..#111:.#44.#32.#87..#114..#100.#33. Try it online! Basically what goes on is #[num] pushes the ASCII value of num onto the top of the stack, : duplicates t...

posted 22d ago by CrSb0001‭

Answer
60%
+1 −0
Q&A Tips for golfing in Python

Assignment expressions (Python 3.8+) The assignment expression (aka the walrus operator) := was introduced in Python 3.8 as a result of PEP 572, which can be used inline to assign a variable as pa...

posted 23d ago by CrSb0001‭

Answer
60%
+1 −0
Challenges Print the modular multiplicative inverse / virtual fractions

Python 3.8, 44 bytes Uses a modulus of 2**16 == 4**8 == 65536. for i in range(1,98,2):print(pow(i,-1,4**8)) How it works: for i in # Iterator ra...

posted 23d ago by CrSb0001‭

Answer
60%
+1 −0
Challenges Find all unique quintuplets in an array that sum to a given target

Inspiration: Leetcode's [3Sum] linkLink on CG&CC Problem Given an array nums of n (not necessarily distinct) integers, and given a target number target, return an array of all of the unique...

2 answers  ·  posted 5mo ago by CrSb0001‭  ·  last activity 1mo ago by panadestein‭

Question code-golf array arithmetic
50%
+0 −0
Challenges "Hello, {name}!"

Lean 4, 39 bytes def x(i:String):String:=s!"Hello, {i}!" Try it online! (Note that TIO only supports Lean 3, so I sadly am unable to use a link from there.)

posted 15d ago by CrSb0001‭

Answer
50%
+1 −1
Challenges Convert to Hexadecimal

Challenge Write a program that takes in a number greater than or equal to 0 and outputs its representation in hexadecimal (base 16). Examples 0 => 0 1 => 1 10 => A 15 ...

2 answers  ·  posted 15d ago by CrSb0001‭  ·  last activity 9d ago by CrSb0001‭

Question code-golf math base hexadecimal
50%
+0 −0
Challenges Is it part of the mandelbrot set?

Python 3.8, 57 bytes -2 bytes (2025-04-02) def m(c): for _ in range(16):(z:=c)*z+c return abs(z)<2 Try it online (59 byte version) Returns False if c (a complex number) is not part o...

posted 25d ago by CrSb0001‭  ·  edited 24d ago by CrSb0001‭

Answer
50%
+0 −0
Challenges Abstract Rewriting Systems (Cops)

Score: 114 ========== =Alphabet= ========== ACDEIOST+ =============== =Source string= =============== ACDEIOST+ =============== =Target string= =============== SE+CODIDACT ======...

posted 4mo ago by CrSb0001‭  ·  edited 4mo ago by CrSb0001‭

Answer
50%
+0 −0
Challenges Abstract Rewriting Systems (Robbers)

This is somewhat of a [proof-golf]-like [cops-and-robbers]. This is the robbers' thread; the cops' thread can be found here. Sections: Robbers Determining a winner Robbers The cops wil...

0 answers  ·  posted 5mo ago by CrSb0001‭  ·  edited 5mo ago by CrSb0001‭

Question cops-and-robbers repeated-transformations grammars
50%
+0 −0
Challenges Abstract Rewriting Systems (Cops)

This is somewhat of a [proof-golf]-like [cops-and-robbers]. This is the cops' thread; the robbers' thread is here Sections: Cops Scoring What is a rewrite rule? An example An example of...

1 answer  ·  posted 5mo ago by CrSb0001‭  ·  last activity 4mo ago by CrSb0001‭

Question cops-and-robbers repeated-transformations grammars