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
Meta Default Rules: Code Golf Answer Types

Anonymous function A code golf answer can be an anonymous function[1]. That is, a function that can be defined without giving it a name (in programming languages that allow this). If an anonymous...

posted 10mo ago by trichoplax‭  ·  edited 10mo ago by trichoplax‭

Answer
60%
+1 −0
Meta Default Rules: Code Golf Answer Types

A snippet is not a valid answer A code golf answer must in general be able to take input[1] and give output. A snippet of code that is not contained in a function or program cannot take input[2], ...

posted 10mo ago by trichoplax‭  ·  edited 10mo ago by trichoplax‭

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 10mo ago by trichoplax‭  ·  last activity 8mo 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 10mo ago by Karl Knechtel‭  ·  edited 10mo ago by Karl Knechtel‭

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 10mo ago by Shaggy‭  ·  edited 8mo ago by Shaggy‭

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 10mo ago by Shaggy‭  ·  edited 10mo ago by Shaggy‭

Answer
60%
+1 −0
Challenges Multiplicative perfection

Japt v1.4.5, 4 bytes ¶â¬× Try it ¶â¬× :Implicit input of integer ¶ :Is equal to ⬠:Proper divisors × :Reduced by multiplication

posted 9mo ago by Shaggy‭

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 9mo ago by Andrew Ray‭

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 9mo ago by trichoplax‭

Answer
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 9mo ago by Europe2048‭

Answer
60%
+1 −0
Challenges Plain black webpage

HTML, 31 Bytes <HTML style="background:black"> The best solution is frequently the easiest one.

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

Answer
60%
+1 −0
Challenges Shortest representation in generalised Roman numerals

Jelly, 45 bytes L‘ḃ5MḢ;‘$œṖƲḅ5aị¥⁸N1¦Sṭ “¢¦½2d‘Çȷ6¡iḃ5ị“IVXLC Try it online! A pair of links that takes an integer as its argument and returns a string with the shortest generalised Roman num...

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

Answer
60%
+1 −0
Challenges Word suggesting

Charcoal, 88 bytes ≔⪪η λFLθ«¿¬⁼θ⁰«≔…θ⁺ι¹π¿№λπ«≔πω§≔λ⌕λω⁰»«¿Σ⭆λ⁼…κ⁺ι¹π«≔§Φλ⁼…κ⁺ι¹π⁰ω§≔λ⌕λω⁰»«θ≔⁰θ»»»»¿¬⁼θ⁰«ω Try it online!

posted 1y ago by ok12d‭

Answer
60%
+1 −0
Challenges Shortest representation in generalised Roman numerals

Find the shortest representation of an integer in generalised Roman numerals. Since there is more than one way to generalise, only the following definition applies to this challenge. Definition T...

1 answer  ·  posted 1y ago by trichoplax‭  ·  last activity 1y ago by NikNakk‭

Question code-golf number
60%
+1 −0
Challenges Single digit Roman numeral

Haskell, 62 bytes (\n->(scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")) No import needed. It just uses standard Prelude functions. scanl(*)1$cycle[5,2] will give you the infinit...

posted 1y ago by Arpad Horvath‭  ·  edited 1y ago by Arpad Horvath‭

Answer
60%
+1 −0
Challenges Single digit Roman numeral

Swift, 114 bytes func y(x:String)->Int?{return ["I":1,"V":5,"X":10,"L":50,"C":100,"D":500,"M":1000].filter{$0.key==x}.first?.value} Try it online! Explanation + Non-Golfed Version The no...

posted 1y ago by MrDevel0per‭  ·  edited 1y ago by trichoplax‭

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

Python 3, 149 bytes g=lambda r:r>1and g(r-1)+g(r-2)or r lambda n:[i for(i)in map(g,range(2*n+2))if(lambda*l:all(abs(n-i)!=1for(n,i)in zip(l,l[1:])))(*map(int,str(i)))][n] Try it online! ...

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

Answer
60%
+1 −0
Challenges Single digit Roman numeral

C, 59 byte h(n){return n&4?n&2?5:n&1?1e3:n&8?50:500:n&2?100:n&1?1:10;} Old version, 60 byte: h(n){return n&4?n&2?5:n&1?1000:n&8?50:500:n&2?100:n&amp...

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

Answer
60%
+1 −0
Challenges Make $2 + 2 = 5$

ESCR - not a golfing answer This isn't really an answer to the question, and it's not an attempt at golfing. However, it shows a cute trick for solving this problem that falls out of the way the ...

posted 1y ago by Olin Lathrop‭  ·  edited 1y ago by Olin Lathrop‭

Answer
60%
+1 −0
Challenges Is it stuck in a counting loop?

Pyth, 8 bytes qu/Red._ Try it online! A list is in a loop if and only if it is the first list seen twice as f is applied repeatedly. qu/Red._ u Apply the following function, ...

posted 1y ago by isaacg‭

Answer
60%
+1 −0
Challenges Can I follow this recipe?

Pyth, 15 bytes !f.A-VtTsM._T.p Try it online! Outputs True if no valid recipe exists, False if one does. If truthy/falsy outputs are allowed, the ! can be removed, to just output all valid per...

posted 1y ago by isaacg‭

Answer
60%
+1 −0
Challenges Plain black webpage

HTML, 28 Bytes <HTML style=background:#000> #000 is shorter than black and quote marks are officially required but browsers figure it out.

posted 1y ago by manassehkatz‭

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

Pyth, 25 23 bytes @f-1aM.:jT;2u+Gs>2GyQU2 Try it online! First, we generate the Fibonacci numbers: u+Gs>2GyQU2 U2 range(2), the list [0, 1] u Apply the follow...

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

Answer
60%
+1 −0
Challenges Plain black webpage

HTML, 25 bytes <style>*{background:#000} Not really sure if this is a legal solution, but technically you can open it in your browser...

posted 1y ago by Moshi‭

Answer
60%
+1 −0
Challenges 99 Shortened Bottles of Beer

JavaScript (V8), 185 bytes for(c=99;c;)print((f=(s=` on the wall`)=>`${c||99} bottle${~-c?`s`:``} of beer`+s)()+`, ${f``}. ${--c?`Take one down and pass it around`:`Go to the store and buy s...

posted 4y ago by Shaggy‭

Answer