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 »

Search

Advanced Search Options

To further refine your search, you can use additional qualifiers such as score:>0.5. For example, the search score:>=0.5 created:<1y grammar would return only posts mentioning "grammar" that have a score >= 0.5 and were created less than a year ago.

Further help with searching is available in the help center.

Quick hints: tag:tagname, user:xxx, "exact phrase", post_type:xxx, created:<N{d,w,mo,y}, score:>=0.5

Filters
 
60%
+1 −0
Challenges How many odd digits?

Vyxal, 4 bytes Expects a string. O2%∑ Try it here! Explanation O2%∑ O ord 2% modulo 2 ∑ sum

posted 7mo ago by Europe2048‭

Answer
60%
+1 −0
Meta Preferred length limit for Code Golf posts

65,535 The database field can already handle up to 65,535 (216 - 1) characters. Same for all post types and categories I don't see a need for different limits for questions and answers, or for d...

posted 7mo ago by trichoplax‭

Answer
60%
+1 −0
Challenges Fibonacci without consecutive digits

Haskell, 110 bytes c[]=1>0 c(a:b:_)|abs(a-b)==1=1<0 c(_:b)=c b f=0:1:zipWith(+)f(tail f) h=[g|g<-f,c.map fromEnum.show$g] r=(h!!) Try it online!

posted 7mo ago by Andrew Ray‭

Answer
60%
+1 −0
Challenges How many odd digits?

Given a positive integer, count its odd digits. Input An integer from 1 to 999,999,999, inclusive, in any of the following formats: A number (such as an integer or floating point number), li...

6 answers  ·  posted 8mo ago by trichoplax‭  ·  last activity 6mo ago by Shaggy‭

Question code-golf number
60%
+1 −0
Challenges How many odd digits?

Python, 37 27 bytes First, with input as an integer: lambda i:sum(ord(x)&1for x in str(i)) This converts the number to string (in the base-10 default) and processes each character. It expl...

posted 8mo ago by Karl Knechtel‭  ·  edited 8mo ago by Karl Knechtel‭

Answer
60%
+1 −0
Challenges How many odd digits?

JavaScript, 25 bytes Input as an array of digits a=>a.map(x=>t+=x%2,t=0)|t Try it online! 26 bytes With input as a string (or an array of digit strings). f=([d,...a])=>d?d%2+f(a):0...

posted 8mo ago by Shaggy‭  ·  edited 8mo ago by Shaggy‭

Answer
60%
+1 −0
Challenges How many odd digits?

Japt -mx, 2 1 byte u Try it u :Implicit map of input array u :Modulo 2 :Implicit output of sum of resulting array

posted 8mo ago by Shaggy‭  ·  edited 6mo ago by Shaggy‭

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 5d 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 17d 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 17d ago by CrSb0001‭

Answer
60%
+1 −0
Challenges Digit balanced numbers

Vyxal, 4 bytes Ċvt≈ Try it Online! Outputs 1 for true, 0 for false. The footer is to convert the output to the provided test case format. Explained Ċvt≈­⁡​‎‎⁡⁠⁡‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁢‏⁠‎⁡⁠...

posted 16d ago by lyxal‭

Answer
60%
+1 −0
Challenges Digit balanced numbers

Vyxal 3, 2 bytes ⊞≈ Vyxal It Online! Shortest you'll probably get barring fractional bytes. Explained ⊞≈ ## Input is a number ⊞ ## Counts of all items in the number ≈ ## Are they all the...

posted 16d ago by lyxal‭

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 15d ago by CrSb0001‭

Answer
60%
+1 −0
Challenges Digit balanced numbers

Python 3, 43 bytes lambda n:len({*map(str(n).count,str(n))})<2 Try it online!

posted 15d ago by m90‭

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 12d ago by CrSb0001‭  ·  edited 3d 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 5d ago by CrSb0001‭  ·  edited 5d ago by CrSb0001‭

Answer
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 12d ago by CrSb0001‭  ·  edited 10d 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 8d ago by CrSb0001‭  ·  edited 2d ago by CrSb0001‭

Answer
60%
+1 −0
Meta Should we delete the code-golf-tips tag?

The code-golf-tips tag seems redundant since we already have code-golf and tips. It also has zero usages. Should this tag be deleted to avoid its future usage?

0 answers  ·  posted 9d ago by trichoplax‭

Question discussion tags
60%
+1 −0
Q&A Rust golfing tips

What tips do you have for saving bytes in Rust? Please post one tip per answer for ease of voting and commenting.

3 answers  ·  posted 9d ago by trichoplax‭  ·  last activity 9d ago by trichoplax‭

Question code-golf code-golf-tips tips
60%
+1 −0
Challenges Prove commutativity on this monoid presentation.

x86-64 machine code, 37 bytes 31 C0 50 50 FF 04 C4 AC 2C 30 79 F8 5A 48 B8 31 30 31 30 AE 51 F3 AB 59 51 F3 AA 88 27 59 FF CA 75 F1 88 17 C3 Try it online! Following the standard calling conve...

posted 6d ago by m90‭  ·  edited 6d ago by m90‭

Answer
60%
+1 −0
Q&A Rust golfing tips

Avoid type annotations with a closure instead of a fn Function (24 bytes) A function requires types to be specified for its return value, and for any arguments it takes. fn f(a:u8,b:u8)->u8{a...

posted 9d ago by trichoplax‭

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 9d ago by CrSb0001‭  ·  edited 3d ago by CrSb0001‭

Answer
60%
+1 −0
Sandbox Digit balanced numbers [FINALIZED]

posted 27d ago by trichoplax‭  ·  edited 16d ago by trichoplax‭

60%
+1 −0
Challenges Bytes to Segfault

x86 machine code, 3 bytes 31 FF AB Try it online! In assembly: xor edi, edi stosd Set EDI to 0 by XORing it with itself, then use the 1-byte stosd instruction to try to write EAX to tha...

posted 6d ago by m90‭

Answer