text stringlengths 180 608k |
|---|
[Question]
[
**This question already has answers here**:
[Visual Long Multiplication](/questions/51396/visual-long-multiplication)
(10 answers)
Closed 4 years ago.
There's a visual method for multiplication that is taught to Japanese schoolchildren [citation needed] that uses lines and crossings to get the a... |
[Question]
[
*Inspired by [this badly received migrated post](https://codegolf.stackexchange.com/questions/60525/generating-non-dictionary-numeric-passcodes).*
The head of security at your company is concerned about your PIN generating system after it gave him `12345`. He also didn't really appreciate the Spaceball... |
[Question]
[
Create a program that halts **exactly** 50% of the time. Be original. Highest voted answer wins. By **exactly** I mean that on *each* run there is a 50% chance of it halting.
[Answer]
### Perl
```
fork || do {sleep(1) while(1)}
```
Each time you run this program, it halts and doesn't halt.
[Answer... |
[Question]
[
In golf, the standard scratch of a course is calculated using this formula:
```
(3*num_of_3_par_holes + 4*num_of_4_par_holes + 5*num_of_5_par_holes) - difficulty_rating
```
Your task is to calculate the standard scratch of a golf course, given these 4 inputs.
You should take input in any standard form ... |
[Question]
[
For a given list of number \$[x\_1, x\_2, x\_3, ..., x\_n]\$ find the last digit of \$x\_1 ^{x\_2 ^ {x\_3 ^ {\dots ^ {x\_n}}}}\$
Example:
```
[3, 4, 2] == 1
[4, 3, 2] == 4
[4, 3, 1] == 4
[5, 3, 2] == 5
```
Because \$3 ^ {(4 ^ 2)} = 3 ^ {16} = 43046721\$.
Because \$4 ^ {(3 ^ 2)} = 4 ^ {9} = 262144\$.... |
[Question]
[
Implement a division algorithm in your favourite language which handles integer division. It need only handle positive numbers - but bonus points if it handles negative and mixed-sign division, too. Results are rounded down for fractional results.
The program may not contain the `/`, `\`, `div` or simi... |
[Question]
[
As a big fan of the [Lost TV series](https://en.wikipedia.org/wiki/Lost_(TV_series)), I always got intrigued by the sequence of numbers that repetitively appears on the episodes. These numbers are:
\$ 4, 8, 15, 16, 23, 42\$ ([A104101](https://oeis.org/A104101))
Using any programming language, write a c... |
[Question]
[
## Description
Given a number, print the amount of `1`s it has in binary representation.
## Input
A number `>= 0` in base 10 that won't exceed the highest number your language is able to handle.
## Output
The amount of `1`s in binary representation.
## Winning condition
The shortest code wins.
## Disal... |
[Question]
[
Your task is to write a program to print the sum of the ASCII codes of the characters of the program itself. You are not allowed to open any file (Any input such as command line arguments, standard input or files is prohibited).
The program that prints the lowest number (i.e. has the lowest sum of ASCI... |
[Question]
[
Create program or function that takes file name as an argument or reads it from standard input, and completes the following task:
1. Read image from a png file (name given as argument).
2. Reverse colors in that image, so that for example dark green (0, 75, 30) would become (255, 180, 225) (because 255... |
[Question]
[
**Input:** A string
**Output:** The rarity of the string, as described below.
To find the rarity of a string, follow the steps below.
* **Start** with **0**.
* **Subtract 3** for each **E, A, T, or O** in the string.
* **Subtract 2** for each **I, N, S, or H** in the string.
* **Subtract 1** for ea... |
[Question]
[
Given an input, output that input followed by a newline endlessly.
Input will be a string consisting only of printable ASCII characters (`0x20-0x7E`) and newlines (`0x0A`).
If input is length 0, endlessly output newlines.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf... |
[Question]
[
**This question already has answers here**:
[Orthodiagonal steps](/questions/164760/orthodiagonal-steps)
(58 answers)
Closed 5 years ago.
List the coordinates of 8 squares adjacent to `(0, 0)` in a 2d grid. Namely,
`[(1,-1),(1,0),(1,1),(0,1),(-1,1),(-1,0),(-1,-1),(0,-1)]`
Order does not matter.... |
[Question]
[
I read about circles somewhere, and just now learned about discs (*it's actually a pretty common concept*) and thought about codegolf.
Your task is to randomize a point/several points on a [disc](https://en.wikipedia.org/wiki/Disk_(mathematics)) with the radius 1.
**Rules:**
* All points must have an ... |
[Question]
[
**Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers.
---
Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win.
Closed 3 years ago.
[Improve this quest... |
[Question]
[
May this challenge serve as ([another](https://codegolf.stackexchange.com/q/175873/70347)) tribute to Stan Lee, who passed away aged 95.
Stan Lee has left us an invaluable legacy and a peculiar catch word: *Excelsior*. So here's a small challenge based on what he said [it was its meaning](https://twitt... |
[Question]
[
**This question already has answers here**:
[Create a binary ruler](/questions/126172/create-a-binary-ruler)
(26 answers)
Closed 6 years ago.
### Input:
A positive integer **N**.
### Challenge:
Suppose you have a list of integers **n = 1, 2 ... N**. Output a list of integers, where each number i... |
[Question]
[
Referring to the printable ASCII character codes in decimal, we know that from 32 to 126 we have the printable characters with 32 being (space). Your challenge is to write a program using only characters from 32 to 125 (excluding 126) which when executed, prints its own source code except that each cha... |
[Question]
[
In the New [Modern Times](http://en.wikipedia.org/wiki/Modern_Times_%28film%29), when Charlie Chaplin encounters a computer, he is employed in the sorting Yard, as a validator to determine if the workers are correctly sorting the items. The Items in question are packets of marbles. Packets with Odd num... |
[Question]
[
# I need a UUID. Your job is to generate one.
The canonical UUID (Universally Unique IDentifier) is a 32 digit hexadecimal number with hyphens inserted in certain points.The program should output 32 hex digits (128 bits), in the form of `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` (`8-4-4-4-12` digits), wher... |
[Question]
[
Most computers store integers in binary, but output them in decimal. However, decimal is just one representation, we just happen to find it convenient.
This challenge is to write some code to output an integer value in ***shortlex decimal***.
What's that?
<http://en.wikipedia.org/wiki/Shortlex_order>... |
[Question]
[
Given integers `N , P > 1` , find the largest integer `M` such that `P ^ M ‚â§ N`.
### I/O:
Input is given as 2 integers `N` and `P`. The output will be the integer `M`.
### Examples:
```
4, 5 -> 0
33, 5 -> 2
40, 20 -> 1
242, 3 -> 4
243, 3 -> 5
400, 2 -> 8
1000, 10 -> 3
```
### Notes:
The input will ... |
[Question]
[
I have this problem where I listen to so much music that I can never remember what songs are called. But even if I remember the lyrics, I won't always know the song's name. But lucky for me, there's a pretty neat formula to determine¹ the title of a song just based on its lyrics.
I'll define the way a ... |
[Question]
[
[Sexy Primes](http://en.wikipedia.org/wiki/Sexy_prime) are pairs of numbers \$(n, n+6)\$ such as \$n\$ and \$n+6\$ are both prime
You need to create a function which will take an integer, check for sexy primes from 0 to that integer, and return an array of arrays.
For example, `listSexy(30)` must retur... |
[Question]
[
Given a non-empty list of integers between 1 and 9 inclusive, find the longest contiguous sublist such that the number of occurrences of each element (of the sublist) within the sublist is equal (*not* the number of consecutive occurrences, just the total count). You may return any non-empty subset of ... |
[Question]
[
**Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/19010/edit).
Closed 7 years ago.
[Improve this question](/p... |
[Question]
[
The program should print every letter combination (lowercase or uppercase, it doesn't matter) in alphabetic order. It must start with `a` and the last printed combination should be `password`.
The output should be:
```
a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ... passwora passworb p... |
[Question]
[
This challenge is simple: Take a path to an `png` image file as input and overwrite that file with a copy of itself rotated 90 degrees clockwise. You may assume that the file has dimensions of 128x128 pixels. You may not use image metadata modifications (like Exif) to rotate the image; the pixels thems... |
[Question]
[
In elementary school, children learn about proper fractions, where the numerator is less than the denominator, and thus the value of the fraction is less than one. Later, they are taught about fractions where the value of the fraction is greater than one, and two different ways to express these fractio... |
[Question]
[
Your task is to find out how often you need to "shuffle" a given list with the following operation until you get back the original list.
```
start with a list:
(1 2 3 4 5 6 7 8 9)
split it into the elements at odd and even indices
(1 3 5 7 9) (2 4 6 8)
concatenate these two list
(1 3 5 7 9 2 4 6 8)
``... |
[Question]
[
## Context
We're at war! You need to transfer an important message to your general to inform them from an imminent assault. The thing is, your enemy knows a lot about cryptography : you will need to be more creative in order to encode your message...
## Task
Create a program that accepts an ascii messa... |
[Question]
[
Given a set of letter grades, output the GPA (grade point average) of those grades, rounded to one decimal place.
Valid grades and their corresponding value are the following:
```
A = 4 grade points
A- = 3.7 grade points
B+ = 3.3 grade points
B = 3 grade points
B- = 2.7 grade points
C+ = 2.3 grade poin... |
[Question]
[
The challenge is simple: Read 3 letters from a system input¹ and convert them to numbers (`A-1, B-2, C-3...Z-26`)². Print each of those numbers in the order the letters were inputted in, each on a new line and then the sum of all 3 numbers, on its own line as well.
NOTE: There will be no extra input ... |
[Question]
[

**Hexadecimal** is a base 16 counting system that goes from `0` to `f`. Your job is to make a counter that will display these numbers.
**Example:**
```
$ python counter.py
1 2 3 4 5 ... |
[Question]
[
# Introduction
Bob runs a deli. His deli serves sandwiches to its customers. However, it is a bit unusual. At Bob's deli, instead of telling Bob what they want, customers show Bob an ASCII art drawing of their sandwich. Bob must find the pattern in their sandwich so he knows what ingredients to prepare... |
[Question]
[
We call a ***parens group*** the open paren `(`, its matching close paren `)` and everything inside them.
A parens group or string is called ***parenthesly balanced*** if it contains either nothing or only 2 parenthesly balanced parens groups.
For example:
```
The string "(()())()" is parenthesl... |
[Question]
[
For the purposes of this question, a deck of cards is formatted in this way:
```
[
"AS", "2S", "3S", "4S", "5S", "6S", "7S", "8S", "9S", "10S", "JS", "QS", "KS",
"AD", "2D", "3D", "4D", "5D", "6D", "7D", "8D", "9D", "10D", "JD", "QD", "KD",
"AH", "2H", "3H", "4H", "5H", "6H", "7H", "8H", "9H", ... |
[Question]
[
Given an array of positive integers, output a stable array of the distinct prime factors of these integers. In other words, for each integer in the input in order, get its prime factors, sort them, and append any primes not already in the output to the output.
# Test Cases
```
[1,2,3,4,5,6,7,8,9,10] ->... |
[Question]
[
Your challenge is to print the input, wait any amount of time, print the input, wait twice the time you initially waited, print the input again, and so on. The initial delay must be less than 1 hour, and you must have an accuracy of +/- 5% in the subsequent delays. Other than that, there is no restrict... |
[Question]
[
Part of [**Advent of Code Golf 2021**](https://codegolf.meta.stackexchange.com/q/24068/78410) event. See the linked meta post for details.
The story continues from [AoC2017 Day 11](https://adventofcode.com/2017/day/11).
[Obligatory why me and not Bubbler link](https://chat.stackexchange.com/transcript/... |
[Question]
[
You are given two strings \$a\$ and \$b\$ consisting of characters from a to z in lowercase. Let \$n\$ be the length of \$a\$. Let \$m\$ be the length of \$b\$. Let \$a'\$ be the string \$a\$ repeated \$m\$ times. Let \$b'\$ be the string \$b\$ repeated \$n\$ times. Check whether \$a'\$ is lexicographi... |
[Question]
[
# Challenge:
Given an array of non-negative whole numbers numbers ~~in the range of `0 to Infinity`~~, Check whether all of them are primes or not. (You can take input as a string too if you want)
# Input:
Input: An array of numbers
Output: The array with every element replaced by one of these:
```
-1 ... |
[Question]
[
Your task is to write a program that runs in two different languages, and does the following:
* In one language, it palindromizes a given string.
+ Take the string. `abcde`
+ Reverse the string. `edcba`
+ Remove the first character. `dcba`
+ Glue it onto the original string. `abcdedcba`
* In anothe... |
[Question]
[
Inspired by [a recent challenge involving Fibonacci numbers](https://codegolf.stackexchange.com/questions/217137/pascals-fibonacci-triangle/) in which [OEIS](https://oeis.org/) was mentioned, I would like to present a challenge of creating a function that generates a wide array of different linear inte... |
[Question]
[
One way to represent a natural number is by multiplying exponents of prime numbers. For example, 6 can be represented by 2^1\*3^1, and 50 can be represented by 2^1\*5^2 (where ^ indicates exponention). The number of primes in this representation can help determine whether it is shorter to use this meth... |
[Question]
[
Inspired by digital roots, the prime factoral root of a number is the number that emerges when you take the prime factors of a number, add them together, and repeat the process on the resulting number, continuing until you end up with a prime number (which has itself as its only prime factor, and is th... |
[Question]
[
The [divisors](https://en.wikipedia.org/wiki/Divisor#Definition) of a natural number form a [poset](https://en.wikipedia.org/wiki/Partially_ordered_set) under the [relation](https://en.wikipedia.org/wiki/Relation_(mathematics)) of "a divides b?", \$a | b\$. This challenge is to produce the number, \$C\... |
[Question]
[
# Introduction
This challenge was inspired by a seemingly simple task requested at work that couldn't easily be done in Microsoft Teams. At least not from what we could find!
## Task
Your task, if you choose to accept it, is to output the last week day of **any month** in **any year**.
## Input
You can... |
[Question]
[
Given a set of positive integers \$ S \$, output the set of all positive integers \$ n \$ such that \$ n \$ can be made by summing a subset of \$ S \$ in more than one different way, i.e., that are the sums of more than one subset of \$ S \$.
To be clear, a subset of \$ S \$ means that you can't use nu... |
[Question]
[
At time of writing, my reputation is \$16,256\$. As I [noted in chat](https://chat.stackexchange.com/transcript/message/55626072#55626072),
>
> Oh cool my rep is the concatenation of two powers of 2: 16,256
>
>
> Or even the concatenation of a power of 2 and its square, which is much more interestin... |
[Question]
[
Some two-dimensional esolangs, such as [Forked](//git.io/Forked), and some non-esolangs, such as [Python](//python.org), can sometimes require spaces before lines of code. This isn't very golfy. Also, I'm lazy and writing a 2d lang that needs lots of spaces before code. Your task is to write a tool tha... |
[Question]
[
Given a non-empty set of strings and a list of strings, find out how many times the set occurs in the list, i.e. how many times you could create the set with items from the list. Every element from the list can only be used once.
>
> Hint: a set is an unordered list of unique items.
>
>
>
Default [... |
[Question]
[
A *palindrome* is a string that is the same forwards and backwards, such as "racecar".
Write a program in some language L, that takes any program P1 in language L as input, and outputs a palindromic program P2 in language L that does the same thing as P1.
You do not need to worry about handling input p... |
[Question]
[
What general tips do you have for golfing in Befunge? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Befunge (e.g. "remove comments" is not an answer). Please post one tip per answer.
[Answer]
When using a multi-line loop, try to u... |
[Question]
[
Generate a cipher given a number and string
Your task is simple. Given a string `s` and a number `0 <= n <= 9` as inputs, insert a pseudo-random printable ASCII character between each character of the string `n` times. Such that for each character of `s` there are `n` random characters between them. Sp... |
[Question]
[
Given the equation of a polynomial and an x-coordinate find the rate of change of the point at that x-coord on the curve.
A polynomial is in the form: axn + axn-1 + ... + ax1 + a, where a ϵ Q and n ϵ W. For this challenge, n can also be 0 if you don't want to have to deal with special cases (constants)... |
[Question]
[
You are the owner of a restaurant. You are opening in a new area in Cartesia where there is only one main road, known as the y-axis. You want to place your restaurant such that you minimize the total distance from your restaurant and each of the houses in that area.
**Input**:
The input will be
```
n, ... |
[Question]
[
We have a challenge to [calculate the hyperfactorial](/q/235964/39490) and one to [count the trailing zeros of the factorial](/q/79762/39490), so it seems logical to put them together and count the trailing zeros in the hyperfactorial.
As a recap, the [hyperfactorial](https://en.wikipedia.org/wiki/Hype... |
[Question]
[
Given as input a positive nonzero integer `n` >= 10 and a sequence of digits `0-9` (which may be taken as a string or a list), find the first contiguous subsequence of digits in the sequence that sums to `n` and output the start and end indexes. You may use zero- or one-based indexing. If no such subse... |
[Question]
[
Mr. William Shakespeare wrote plays. A lot of plays. In this [tarball](https://web.archive.org/web/20121019174006/http://sydney.edu.au/engineering/it/%7Ematty/Shakespeare/shakespeare.tar.gz) containing every single one of his works, each one of his plays is one long file.
It needs to be split into Sc... |
[Question]
[
This challenge is to golf an implementation of SKI formal combinator calculus.
# Definition
## Terms
`S`, `K`, and `I` are terms.
If *x* and *y* are terms then `(xy)` is a term.
## Evaluation
The following three steps will be repeated until none of them apply.
In these, x, y, and z must be terms.
`(Ix)... |
[Question]
[
Write a program that takes a string and outputs all the characters in alphabetical order.
Spaces and symbols can be ignored or deleted, but the upper- and lowercase letters must remain the same case.
Sample input:
```
Johnny walked the dog to the park.
```
Sample output
```
aaddeeeghhhJklnnoooprtttwy
`... |
[Question]
[
Most Unicode characters have full names, for example `”` is "RIGHT DOUBLE QUOTATION MARK". You can find a useful reference [here](https://www.fileformat.info/info/unicode/char/search.htm), just type in the character you want to find the full name of and look in the DESCRIPTION column.
Your challenge is... |
[Question]
[
The `round` function in Python 3 will round values of the form \$k+\frac{1}{2}\$ (with \$k\$ being an integer) to the nearest **even** integer, which is apparently [better than the rounding method taught in school](https://stackoverflow.com/questions/10825926/python-3-x-rounding-behavior/10825998#10825... |
[Question]
[
This sequence is defined as
* Starts with 1, 2, 3
* The next element of the sequence is the first number greater than the previous three that is co-prime with each of the previous *3* elements in the sequence.
+ In other words, if the previous 3 elements are `a`, `b`, `c`, then the next is the first i... |
[Question]
[
Similar to [this](https://codegolf.stackexchange.com/questions/236301/swap-two-values-in-a-list).
Input a list and rotate N numbers in it given their indices. The following example uses 1-indexing, but feel free to use either.
In other words, take a list of indices and a list of numbers:
```
[1,2,3,4,5... |
[Question]
[
When making a Minecraft data/resource pack, you need to include a `pack.mcmeta` file, which specifies information about it. `pack.mcmeta` contains a description, but it also contains a `pack_format` number, which tells Minecraft which versions this pack is for.
Your task is to take a version string, an... |
[Question]
[
**Specs**
1. You have a cubic 3D space `x,y,z` of size `S` integer units, such as `0 <= x,y,z <= S`.
2. You get from [default input methods](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods?answertab=votes#tab-top) an array of points `P` represented as `... |
[Question]
[
A *Bell number* ([OEIS A000110](https://oeis.org/A000110)) is the number of ways to partition a set of n labeled (distinct) elements. The 0th Bell number is defined as 1.
Let's look at some examples (I use brackets to denote the subsets and braces for the partitions):
```
1: {1}
2: {[1,2]}, {[1],[2]}
3... |
[Question]
[
**Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/10759/edit).
Closed 6 years ago.
[Improve this question](/p... |
[Question]
[
We don't have a challenge for conversion between [Cartesian and polar coordinates](https://en.wikipedia.org/wiki/Polar_coordinate_system#Converting_between_polar_and_Cartesian_coordinates), so ...
### The challenge
Write **two programs** (or functions) in the same language:
* one that converts from pol... |
[Question]
[
Draw an "apartment" building according to the specifications below.
## Basic Rules
Take, as input, the number of floors of the building.
Return a building with that many floors meeting the following specifications:
The building will be eight characters wide, with eight underscore characters (`_`) on to... |
[Question]
[
From [this](https://stackoverflow.com/questions/52764321/how-to-loop-2d-array-in-a-anti-clock-wise-fashion) stackoverflow question
Given a 2D array of size \$ M \times N \$, output the values in a anti-clockwise fashion. The output must start from the outside to the inside and the initial point always ... |
[Question]
[
**This question already has answers here**:
[Largest and smallest values from concatenated integers](/questions/49854/largest-and-smallest-values-from-concatenated-integers)
(17 answers)
Closed 6 years ago.
Write a function or program that given a **list** of **non negative** integers, arranges ... |
[Question]
[
Let's say I've got some ASCII art:
```
___
,"---".
: ;
`-.-'
| |
| |
| |
_.-\_/-._
_ / | | \ _
/ / `---' \ \
/ `-----------' \
/,-""-. ,-""-.\
( i-..-i i-..-i )
|`| |-------| |'|
\ `-..-' ... |
[Question]
[
>
> Every palindrome with an even number of digits is divisible by 11, so 11 is the only [palindromic prime] with an even number of digits. - [David Wasserman, OEIS](https://oeis.org/A002385)
>
>
>
I learned this today the manual way, before I did my research, when my program skipped numbers with a... |
[Question]
[
From [Wikipedia](https://en.wikipedia.org/wiki/Centroid#Centroid_of_polygon):
>
> The centroid of a non-self-intersecting closed polygon
> defined by *n* vertices (*x0,y0*),
> (*x1,y1*), ...,
> (*xn−1,yn−1*) is the point (*Cx,
> Cy*), where
>
>
> [
(14 answers)
Closed 10 years ago.
The puzzle is as follows:
Create the traditional 'Guess my Number' game in as little keystrokes as possible. The player should input a guess between and inc... |
[Question]
[
Given an input value \$n\$, construct an array of \$n\$ random 128 bit (unsigned) integers. The integers should be uniformly random.
Your code can use any in built random number generation function it has or you can implement your own. Clearly this challenge is harder (and more fun) in lower level lang... |
[Question]
[
The [generalised harmonic number](https://en.wikipedia.org/wiki/Harmonic_number#Generalized_harmonic_numbers) of order \$m\$ of \$n\$ is
$$H\_{n,m} = \sum^n\_{k=1} \frac 1 {k^m}$$
In this challenge, we'll be considering the generalised harmonic numbers of order \$2\$:
$$H\_{n,2} = \sum^n\_{k=1} \frac 1... |
[Question]
[
Your goal is to write a program that prints the string `abc` in two languages. However, while the full code will print `abc` in one language (we'll call it Language 1), the other one (Language 2) must print `abc` if (and only if) every other character is skipped starting from the second character. If t... |
[Question]
[
Given an integer greater than 1, output the number of ways it can be expressed as the sum of one or more consecutive primes.
Order of summands doesn't matter. A sum can consist of a single number (so the output for any prime will be at least 1.)
This is [code-golf](/questions/tagged/code-golf "show qu... |
[Question]
[
### The Language: Oppification
A funny language to speak is created by applying the following process to each word:
1. Place `op` after each consonant. So `Code` becomes `Copodope`.
Yes, that's it. For the purpose of this challenge, `y` is always a consonant.
### The Challenge: De-oppification
Given an... |
[Question]
[
# The "problem"
Define a function `log` (or other 3 letter name) which when called will log/print/write (whatever is the default for the language in question) both the instruction (as source) and the first argument. In other words:
```
i=777
j=333
log(i) //outputs: "log(i) 777"
log(i+j+1) //outputs: "l... |
[Question]
[
For this code golf, you will receive an input of a **fib**onacci sequence, that is, a normal Fibonacci sequence but with one number incorrect. See, the sequence is *fibbing*! Get it? `:D`
Your job is to find out which number is incorrect, and print the index (0-based) of that number.
For example:
```
I... |
[Question]
[
Carry sort is an \$O(n)\$ "sorting" algorithm. Here's how it works. The algorithm moves left to right along a list. As it traverses a list it "carries" a single item, the largest item it has encountered so far. Once it encounters a larger item it picks up that item and drops the item it is already carr... |
[Question]
[
Your task is to write a program or function which takes a pure brainflak program as input (assume it contains only balanced `()[]{}<>`), and output a visually mirrored copy of it.
If you reversed a brainflak program as a string, say `({}())` (add one to an input), you would get `))(}{(`, which is not v... |
[Question]
[
## Description
Write a program or function that takes in a positive integer \$n\$ as input and outputs all Sophie Germain primes that are safe primes less than or equal to \$n\$. A prime number \$p\$ is a Sophie Germain prime if \$2p+1\$ is also a prime. A prime number \$p\$ is a safe prime if \$p=2q+1... |
[Question]
[
[Cops' Thread](https://codegolf.stackexchange.com/questions/231321)
Your challenge is to find an uncracked, unsafe cop on the cops thread, and find an input value for which their code does not do as specified by the challenge.
You must use values within the bounds specified by the cop and the challenge... |
[Question]
[
### Challenge
Given a positive integer `N`, output the sum of the first `N` reciprocals as an exact fraction, which is represented as a pair of integers in a consistent order representing numerator and denominator.
### Rules
* Output must be exact.
* Output should be as a pair of integers in a consiste... |
[Question]
[
Probably a simple code-golf challenge. Given 2 positive integers `m` and `n`, make a list of `n` values that are positive integers whose sum is equal to the number `m`. Either all values in the output are the same value or the difference is exactly 1.
**Examples**
For example
* `m=6` and `n=3` would be... |
[Question]
[
# Input
A non-empty string or list of capital letters `k` with length between 3 to 5000.
# Output
A value indicating whether `k` can be expressed as `a+b+b`, where `a` and `b` are non-empty.
# Truthy test cases
```
SSS
SNYYY
SNYY
SNNYY
SNYNY
```
# Falsy test cases
```
FALSYTESTCASES
FALSYFALSYTESTCASES... |
[Question]
[
I made this because, although we have a bunch of other questions involving smiley faces, there is nothing for just printing an ASCII smiley face with as little code as possible.
Anyway, print this exactly (Trailing spaces allowed):
```
**********
******************
**********************
... |
[Question]
[
### Introduction
*Pareidolia*: From Ancient Greek; *παρα* (*para*, “concurrent, alongside”) + *εἴδωλον* (*eídōlon*, “image”). The tendency to interpret a vague stimulus as something known to the observer, such as interpreting marks on Mars as canals, seeing shapes in clouds, or hearing hidden message... |
[Question]
[
You have played \$N\$ matches in some game where each match can only result in one of the two outcomes: win or loss. Currently, you have \$W\$ wins. You want to have a win percentage of \$P\$ or more, **playing as few matches as possible**. Output the minimum win streak that you need. Assume the curren... |
[Question]
[
The title is valid Jelly Code which has the same output as `L€€` except printed twice.
### Background
You can skip this section without losing ability to complete the challenge
Some operations in Jelly try to convert its argument to a list first before applying the operation. One example is `€`, the ... |
[Question]
[
[Kirchhoff's law](https://en.wikipedia.org/wiki/Kirchhoff%27s_circuit_laws#) says that when you sum up all the currents (positive for the currents going to a junction, and negative for current leaving a junction), you will always get as result 0.
Look at the following diagram:
[![enter image descriptio... |
[Question]
[
# Introduction
The [Baker's map](http://en.wikipedia.org/wiki/Baker%27s_map) is an important dynamical system that exhibits chaotic behavior.
It is a function from the unit square to itself defined intuitively as follows.
* Cut the square vertically in half, resulting in two rectangles of size `0.5×1`.... |
[Question]
[
# Definition
Narcissistic 1 integers of an array think they are better than their neighbours, because they are strictly higher than their arithmetic mean.
Neighbours are defined as follows:
* If the integer is at index **0** (the first), then its neighbours are the last and the second elements of the l... |
[Question]
[
Did you notice, that this is a palindrome?
**Input**
Non-negative integer number or string representing it
**Output**
4 possible outputs, representing two properties of number:
* is it palindrome
* tricky #2
**Tricky #2 property**
If number is not palindrome, this property answers the question "... |
Subsets and Splits
Python Q&A Count
Counts the number of questions and answers related to Python in the dataset, providing insight into the prevalence of Python content.