Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
For challenges where an exact output is not required but some property must still be fulfilled.
1
vote
Give f and g that sometimes commute
Vyxal, 1 + 1 = 2 bytes
f(x) = ‹ and g(x) = ȧ.
ȧ is absolute value and ‹ is decrement, so \$f(g(x))\$ = \$\left|x-1\right|\$ and \$g(f(x))\$ = \$ \left|x\right| - 1\$, which are the same only on positi …
2
votes
Generate a mantis's head (symmetrical triangle)
Vyxal r, 18 16 bytes
⅛ɾṘƛ¼:n≤:Sn*,[-⅛
Try it Online!
⅛ # (Implicit input) Push to global array
ɾṘ # (Implicit input) range(1,n+1) reversed
ƛ # Foreach [n]
…
1
vote
Three other numbers
Vyxal, 9 bytes
∑5*‹ʁ7%⊍Ḣ
Try it Online!
Porting Pyth saves two bytes.
9
votes
Output a random unary string
Vyxal 2.4.1, 6 bytes
{×₴₀℅|
Try it Online!
We use v2.4.1 because it seems in 2.6 and later there's no way to get a random bit in two bytes.
{ # Forever...
×₴ # Print an asterisk
| # Whi …
3
votes
Turing-Complete Language Interpreter
Vyxal implementing "add minimum to transpose", 4 bytes
{:g+
Try it Online! (prints each iteration)
{ # Forever
+ # Add to each
:g # Corresponding element of minimum row
See this answer for a …
1
vote
What an Odd Function
Vyxal, 8 bytes
Þ∞y$:ẇYf
Try it Online!
Challenge number 1 - a list with an odd probability 1. Creates an infinite list.
The sequence generated looks like \$2, \color{red}{1}, \color{black}{4}, \color …
4
votes
Transform characters of your choice into "Hello, world!"
Vyxal, 6 bytes
kakH¡Ŀ
Try it Online! Takes a, b, ... m
Ŀ # Transliterate
ka # Lowercase alphabet
kH¡ # To corresponding chars of "Hello, world!"
6
votes
Generate an arbitrary half of a string
Vyxal, 8 bytes
ṗṠ'ds?s=
Try it Online!
Tack on a ;U if halves must be unique.
ṗṠ # Subsequences as strings
' # Filtered by
ds # It doubled, sorted
= # Equals...
?s # T …
6
votes
Turing-Complete Language Interpreter
Vyxal interpreting Thue variant, 1 byte
¢
Try it Online!
¢ is a builtin that performs infinite replacement. When given a string \$s\$, a list of targets \$[t_1, t_2 ... t_n] \$, and a list of replace …
7
votes
Tic-tac-toe encode them all
Vyxal, 17 bytes
2ʀ9↔µ∑;«+⅛«İṠḟbṅḢ
Try it Online!
This relies on a couple of very nice coincidences:
Padding the output to length 13 would cost 4 bytes 13∆Z. One thing we could do to avoid this is, i …
1
vote
Tic-tac-toe encode them all
Jelly, 16 bytes
3ṗ9SÞị“o x”iµBḊV
Try it online! Port of my Vyxal, see that for an explanation of why this works.
i # Find the index of the input in
ṗ # All combinations …
5
votes
All sequences as substrings
Vyxal, 8 bytes
Þ∞ƛṄvṖ;f
Try it Online!
Pretty much the sequence in the question, but with a lot more 1s. Outputs as an infinite lazy list.
ƛ ; # Over each element of...
Þ∞ # 1...∞
Ṅ …
3
votes
Print all integers
Vyxal, 5 bytes
{N…ꜝ…
Try it Online!
{ # Forever...
N # Negate
… # Print
ꜝ # ~
… # Print
2
votes
Enumerate the rationals
Vyxal, 19 bytes
›"ƛȧ‹*[½₍⌊⌈Uvx∑;÷ȧ"
Try it Online!
A mess. Uses the Stern-Brocot sequence and works in theory...
Given an integer, outputs a pair of integers.
›" # [n, n+1]
ƛ …
6
votes
Enumerate the rationals
Vyxal, 12 bytes
⌊d-‹Ė)1Ḟ:NY‹
Try it Online!
A completely different tactic, using an alternating form of the Calkin-Wilf sequence inspired by Jordan's answer. Append an i if outputting an infinite seq …