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

76 posts
85%
+10 −0
Challenges Looping counter

Looping counter Create an infinite loop that outputs lines of asterisks, with each line containing one more asterisk. Instead of the asterisk, any printable, non-whitespace character can be used. ...

21 answers  ·  posted 2y ago by celtschk‭  ·  last activity 3mo ago by xrs‭

Question code-golf
81%
+7 −0
Challenges Determine whether an integer is square-free

An integer is called square-free if it is not a multiple of a perfect square other than 1. For example, 42 is square-free, but 44 is not because it is a multiple of the perfect square 4 = 2². Your...

13 answers  ·  posted 3y ago by celtschk‭  ·  last activity 2y ago by Shaggy‭

80%
+6 −0
Challenges 1, 2, Fizz, 4, Buzz!

C (gcc), 113 Bytes i;main(){while(i++<100){char*h[]={"%d "," "},**p=h;i%3||(*p++="Fizz%2$s");i%5||(*p="Buzz ");printf(*h,i,h[1]);}} This compiles with several warnings, but no errors. Here'...

posted 4y ago by celtschk‭  ·  edited 4y ago by celtschk‭

Answer
77%
+5 −0
Sandbox Repeat the characters [FINALIZED]

posted 3y ago by celtschk‭  ·  edited 1y ago by trichoplax‭

77%
+5 −0
Challenges Repeat the characters

Given a string and a non-negative integer $n$, output a new string in which each character is repeated $n$ times. Test cases: "abc", 1 -> "abc" "Hello", 0 -> "" "double", 2 -> "ddo...

14 answers  ·  posted 3y ago by celtschk‭  ·  last activity 3y ago by south‭

Question code-golf string
77%
+5 −0
Challenges Decode periodic decimal fractions

Rational numbers in decimal representation can have an infinite periodic part. One common way to write this down is to repeat the periodic digits and then add three dots. Numbers without those thre...

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

77%
+5 −0
Meta New solution to same challenge in same language: Change existing answer or add new one?

A while ago I wrote an answer in C (gcc) to the FizzBuzz challenge. Now I've found a shorter solution for the same compiler, which however uses a completely different strategy. Now I wonder if I s...

1 answer  ·  posted 3y ago by celtschk‭  ·  edited 1y ago by trichoplax‭

75%
+4 −0
Challenges Generate Lewis Caroll's Jabberwocky

The task is to generate the text of Lewis Caroll's Jabberwocky. The text, quoted from Wikipedia, is as follows (I've replaced a non-ASCII character with ASCII, otherwise it's direct copy&paste...

4 answers  ·  posted 4y ago by celtschk‭  ·  last activity 3y ago by General Sebast1an‭

75%
+4 −0
Challenges Make my value binary

C (gcc), 35 32 bytes Saved 3 bytes thanks to Lundin f(n){n&&f(n/2);putchar(n&1|48);} This solution exploits that leading zeros, while not required, are also not forbidden by the ...

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

Answer
75%
+4 −0
Sandbox Decode periodic decimal fractions [FINALIZED]

posted 3y ago by celtschk‭  ·  edited 1y ago by trichoplax‭

75%
+4 −0
Challenges Golf golf challenge

C (gcc), 133 131 bytes f(p,s){char*t="Hole in one\0Albatross\0Eagle\0Birdie\0Par\0Bogey\0Double bogey\0Triple bogey";for(--s?s+=5-p:0;s-=!*t++;);puts(t);} Saved two bytes thanks to m90 in the...

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

Answer
75%
+4 −0
Challenges Implement Rule 110

[Rule 110] is a Turing complete cellular automaton. It is defined as follows: Take as initial value a sequence of symbols that's infinite to both sides, which consists only of two different symbol...

1 answer  ·  posted 3y ago by celtschk‭  ·  last activity 3y ago by Moshi‭

71%
+3 −0
Sandbox Find good coalitions [FINALIZED]

posted 3y ago by celtschk‭  ·  edited 1y ago by trichoplax‭

71%
+3 −0
Meta Thoughts on hiding challenge sections with expandable details tags

I think everything strictly needed to write or judge a solution should never be hidden. If you feel it is too large, think about how to shorten it. Information that is not strictly necessary can b...

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

Answer
71%
+3 −0
Sandbox Looping counter [FINALIZED]

posted 2y ago by celtschk‭  ·  edited 1y ago by trichoplax‭

71%
+3 −0
71%
+3 −0
Challenges Operation "Find The Operator"

Python 3, 106 91 bytes Saved 15 bytes thanks to Moshi in the comments lambda a,b,c:[p for p in"+ - * // % **".split()if(p in'+-**'or b)and eval(f"{a}{p}{b}")==c] Try it online!

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

Answer
71%
+3 −0
Challenges Run-length encode a byte sequence

Run-length encoding is a simple compression technique which compresses sequences of repeating identical bytes. The encoding rules for this task are as follows: Any sequence of $n$ identical bytes...

2 answers  ·  posted 3y ago by celtschk‭  ·  last activity 3y ago by Moshi‭

Question code-golf encoding
71%
+3 −0
Challenges Find good coalitions

As you might know, there were elections in Germany, and now the parties have to form a government coalition. Let's help them with it! A good coalition has the strict majority of seats (that is, mo...

2 answers  ·  posted 3y ago by celtschk‭  ·  last activity 3y ago by Moshi‭

Question code-golf
71%
+3 −0
Challenges Encode and decode floating point integers

Imagine you have only one byte (8 bits) to store a value, but need to store values from $0$ to $4032$. Impossible, until you are also told that an error of 1/64 of the exact value does not matter. ...

2 answers  ·  posted 3y ago by celtschk‭  ·  last activity 3y ago by General Sebast1an‭

Question code-golf number
71%
+3 −0
Challenges Convert integer to English

Given a non-negative integer up to $999\,999\,999$, write it in English. The input number can be in any form other than English (though you'll typically want to use the native integer type of your...

3 answers  ·  posted 3y ago by celtschk‭  ·  last activity 3y ago by Moshi‭

71%
+3 −0
71%
+3 −0
Challenges Collatz conjecture; Count the tries to reach $1$

Python 3, 48 42 39 bytes Saved 6 bytes thanks to Hakerh400‭ in the comments Saved another 3 bytes thanks to user in the comments f=lambda n:n-1and-~f([n//2,3*n+1][n%2]) Try it online!

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

Answer
71%
+3 −0
Challenges Abbreviate everything

Python 3, 142 bytes def f(s): m=1;r="" for c in s.upper(): if'@'<c<'['or'-'==c:r+=c*m;m=0 if c in":; ":r+=c*(c!=' ');m=1 if c in".?!":r+=' ';m=1 return r Try it online!

posted 3y ago by celtschk‭

Answer
71%
+3 −0
Sandbox Run-length encode a byte sequence [FINALIZED]

posted 4y ago by celtschk‭  ·  edited 1y ago by trichoplax‭