All Questions

Filter by
Sorted by
Tagged with
6
votes
2answers
207 views

Find the largest recurring prime

Inspired by Find the largest fragile prime A recurring prime (or whatever you choose to call it) is a prime that, when removing leading digits, always remain prime regardless of how many digits are ...
-4
votes
0answers
51 views

Heuristic pseudo-prime generator [closed]

Your task is to write a program that accepts an input N and outputs an integer p in the range [2,N]. (2 to N inclusive) As the title mentioned, the output p must be a probable pseudo-prime. How I ...
-1
votes
0answers
50 views

Merge Singly Linked Lists in between [closed]

Merge list2 into list1, between a and b ...
-1
votes
0answers
56 views

SKIO calculus solver [closed]

Make a program that calculates SKIO calculus output of a given string. Instructions: Take a binary string as input. Output the result. Write it in as short as you can. Shortest code wins. More at ...
6
votes
14answers
339 views

Sort list by types

Rules You have a list (L) that contains integers and strings. Your task is to move all strings to the end of the list and all integers to the beginning of the list. It is a code-golf so the lowerest ...
-1
votes
0answers
104 views

Hash bomb filtrate

Pipe a short stream to the following Java program run with accompanying command line options, such that it prints true. ...
8
votes
19answers
538 views

Drawing one-liner

CodeDrawing one-liner Teaser Behold this formidable drawing: Can you draw this in a single stroke? Give it a try. Can you do this one, now: Give it a try. How it works These "make this drawing ...
24
votes
12answers
2k views

Fastest yes in the west

There has been a question about yes in the past, but this one is slightly different. You see, despite yes having a rather long size, it is incredibly fast. Running ...
0
votes
0answers
64 views

Interpret CJS inside of Javascript. Raw Strings [closed]

Background: Javascript has a built in function. Eval. The Evil Eval. We know its issues, and we know its one and a very rare while uses. I wanted to see someone emulate CJS in JS, which is a made up ...
19
votes
17answers
1k views

Answer templating

Context Just look around! Whenever someone posts an answer, the same template is followed over and over again! A first line with the byte count and language name. Then the code. Then the TIO link. ...
10
votes
8answers
1k views

Integer Logarithm

Objective Take \$a \in ℤ_{>1}\$ and \$b \in ℤ_+\$ as inputs. Write a function \$f\$ such that: $$ f(a,b) = \left\{ \begin{array}{ll} \log_ab & \quad \text{if} \space \log_ab \in ℚ ...
19
votes
1answer
480 views

Are They Similar Polygons?

Task Given the x,y coordinates (coordinates are guaranteed to be integers) of the vertices of two simple polygons in clockwise or anti-clockwise order. Output a Truthy value if both the polygons are ...
3
votes
0answers
89 views

Predictor Generator [closed]

Write a program that when given a string \$S\$, it generates a program of the same language as itself. The generated program, when given a continuous substring of \$S\$, should predict the next ...
5
votes
4answers
446 views

Count regex matches

Your task Given a simple regular expression, you have to count how many strings of length n have a match of length n with the ...
10
votes
0answers
232 views

Gossipping ladies

Problem description Vertices \$V\$ of directed graph \$G=(V,E)\$ represent gossipping ladies; edge \$(u,v) \in E\$ signifies that lady \$u\$ knows of lady \$v\$ (which does not imply that lady \$v\$ ...
16
votes
32answers
2k views

Is it a doubling sequence?

A doubling sequence is an array of numbers where each subsequent number is at least twice the previous number. Given an ordered list of numbers, determine if the numbers in the list (\$n_{x}\$) have ...
3
votes
5answers
262 views

Find the most important character

Find the most important character The challenge is to write a program that outputs the most occurrent character in the input string, excluding these bracketing characters ...
36
votes
36answers
7k views

Is this a triangle?

Task Write a function/program that, given three positive integers a, b and c, prints a ...
-6
votes
0answers
65 views

Draw a sierpinski triangle in python using recursion [closed]

How to draw this shape by just using draw(level, length)?
6
votes
13answers
152 views

Computational Parity Party! [duplicate]

The computational parity of an integer is defined as 1 if the integer has an odd number of set bits, and 0 otherwise. (src). Input You will receive one nonnegative integer that you will take the ...
19
votes
38answers
2k views

Reversed Iota's

I didn't invent this challenge, but I find it very interesting to solve. For every input number, e.g.: 4 Generate a range from 1 to that number: ...
14
votes
12answers
198 views

Combinations of stepwise increasing integers

Working on something in probability theory, I stumbled across another combinatorical exercise. These are always fun to solve, searching for intelligent approaches. Of course, one can use brute force ...
-1
votes
0answers
115 views

Regex Golf: Find all escaped characters in a Wikipedia page on the subject of escape character overuse [closed]

Every match should include both the escape character and the escaped character. https://en.wikipedia.org/wiki/Leaning_toothpick_syndrome Rules: You can perform the search on the content of the ...
22
votes
7answers
2k views

10-pin bowling split spare

Bowling Bowling is a game where, essentially, each player gets 10 turns to: Take 2 attempts at knocking down 10 pins arranged in a triangle. between turns the pins are reset from the 1st to the 2nd ...
1
vote
0answers
49 views

Shortest Sorting algorithm [duplicate]

So, you need to create the shortest sorting algorithm with a resonably fast run time. It could be any sorting algorithm. Test code: ...
33
votes
36answers
4k views

Lonely Multiplication

Based on this question from Code Review. Given precisely three positive integers, return the product of all of the distinct inputs. If none of the inputs are distinct, return 1. That is, implement ...
1
vote
1answer
101 views

Self-loathing program/function [duplicate]

Simple task, write a program/function that returns error if and only if presented with itself. The program must give a valid output for any input other than itself. For the error part, you can only ...
0
votes
0answers
92 views

Let's learn a bit French: 99 Bottles [duplicate]

The 99 bottles in French The lyrics of the song goes like this: ...
1
vote
1answer
125 views

Name an arbitrary string [closed]

This should be easy: given an arbitrary string, your program will give it a name. Requirements Your program will accept an input of a UTF8 string, and output a string representing the input's "name",...
9
votes
5answers
175 views

Count switches in a smallest square root sequence mod \$2^n\$

Definition For any \$a\equiv1\ (\text{mod }8)\$ and \$n\ge3\$, there are exactly 4 roots to the equation \$x^2\equiv a\ (\text{mod }2^n)\$. Now, let \$x_k(a)\$ be the smallest root to the equation \$...
9
votes
1answer
171 views

Count the Shantens

Introduction to Mahjong tiles Mahjong (麻雀) is a board game that originates from China. Mahjong tiles used in this challenge are in Unicode points U+1F000 – U+1F021: ...
-2
votes
0answers
81 views

By what factor must you divide the perimeter of a circle to return the maximum quantity of sines with terminating decimals? [closed]

This is a question which occurred to me in a dispute about which way of calculating sines leads to the most numerically pleasing results. In particular, with numbers which can be handled exactly. The ...
30
votes
27answers
5k views

How far should I sum?

How far should I sum? The harmonic series is the "infinite sum" of all the fractions of the form \$\frac1n\$ for \$n\$ positive integer. I.e. the harmonic series is $$\frac11 + \frac12 + \frac13 + \...
-4
votes
0answers
40 views

A task with some matches [closed]

members) I got some task with 5 matches you must move 2 of them to make figure More details in the file https://www.sendspace.com/file/2zwnon
21
votes
24answers
2k views

Can I join the music box?

The magic music box (MMB) This explains the motivation for the challenge, feel free to ignore. The magic music box is a word game played by a group of people, where one is the owner of the magic ...
3
votes
1answer
206 views

Estimate the mean minimum Hamming distance

Task Inputs \$b \leq 100\$ and \$n \geq 2\$. Consider \$n\$ binary strings, each of length \$b\$ sampled uniformly and independently. We would like to compute the expected minimum Hamming distance ...
1
vote
5answers
338 views

Write some Random English

Your Goal: Given an odd integer input n greater than 1, generate a random English word of length n. An English word is one in ...
3
votes
5answers
252 views

Implement a Caesar Cipher with a Digit Shift

I assume everyone here is familiar with the Caesar Cipher that shifts letters to a certain index. https://en.wikipedia.org/wiki/Caesar_cipher for those who still needs introduction. But, we can all ...
1
vote
0answers
123 views

What does the shortest pseudo-random algorithm look like? [closed]

After seeing some impossibly short solutions in this SE, I began to wonder what code someone could come up with to build a pseudo-random number generator. Now given that I am new to programming, I ...
27
votes
12answers
3k views

Compress 8 bits to 6 when certain bit patterns will never occur

Consider an eight bit number in which an even position bit will never be 1 if one of its neighbors is 0 (considering MSB and LSB as neighbors). There are fewer than 64 such numbers, so there is at ...
21
votes
35answers
2k views

Give me Triangles [duplicate]

Given an integer n>0, write a program that will output an "isosceles" Triangle out of #'s of height n. Examples: ...
22
votes
22answers
1k views

Mountain range numbers

Mountain range number A number is a mountain range number if the inequalities satisfied by their consecutive digits alternate. In a way, looking at the number's digits should exhibit a ...
27
votes
25answers
2k views

The Magical Piper

An old test for programmers, taken from here (Note: in italian). Along a road (denoted by '_'), there is a Magical Piper (denoted by '...
29
votes
19answers
4k views

Print this maximally long URL

Task This one is simple. We want to compress a URL, but don't trust URL shorteners. Write a program that prints to stdout (or a 0-argument function that returns) the following, working URL: http://...
4
votes
3answers
174 views

Shortest POSIX command line that eagerly removes dual newline sequences

Example: echo -ne 'a\n\nb\nc\n\n\n\nd\n\n\n' | your-command should output the same as echo -ne 'ab\ncd\n' Watch out, some ...
11
votes
3answers
1k views

Intersection of circles – How can I reduce this golf code to 127 bytes?

I started a CodeWars kata in Python, just two days ago, related to code golf. Task: Given two congruent circles a and b of radius r, return the area of their intersection rounded down to the nearest ...
15
votes
12answers
1k views

It's all about the sum of the digits

The sequence Given an integer \$n>0\$, we define \$a(n)\$ as the lowest positive integer such that there exists exactly \$n\$ positive integers smaller than \$a(n)\$ whose sum of digits is equal ...
21
votes
17answers
2k views

Concentric rings on a snub square tiling

This challenge takes place on the snub square tiling. Start by choosing any triangle, and color it \$c_1\$. Next, find all tiles which touch this triangle at any vertex, and color them \$c_2\$. Next,...
25
votes
7answers
1k views

Roll a cube to a target position

You have your very heavy cubical box on a flat floor at position (0,0). All you can do with it is roll it in four cardinal directions (east, north, west, south). Your task is to bring it to a target ...
27
votes
24answers
4k views

Calculate the Progressive Mean™

Disclaimer: This challenge is inspired by a coding error I once made. Okay, time for a maths lesson. A normal mean average looks like this: ...

15 30 50 per page
1 2 3 4 5 225