Skip to main content
10 votes

Numbers with distinct decimal digits

Haskell, 37 bytes import Data.List nub$nub.show<$>[1..] Try it online! Takes each number, removes duplicate digits from its string representation while ...
xnor's user avatar
  • 145k
8 votes

First odd then even indices

K (ngn/k), 12 bytes #{x@<2!!#x}\ Try it online! { ... }\ Iterate until reaching the first value again (or a fixed point). ...
ovs's user avatar
  • 59.5k
8 votes

First odd then even indices

Thunno 2 L, 4 bytes µ¥zS Try it online! or verify all test cases µ¥zḞ Try it online! or ...
The Thonnu's user avatar
  • 18.1k
7 votes

Count N-Rich Permutations of an Integer Sequence

Husk, 9 bytes #mȯ▲mLġ>P Try it online! or Try the test lists with N=2 ...
Dominic van Essen's user avatar
7 votes

First odd then even indices

J, 26 24 bytes i.~_:0}(\:2|#\)^:(3<@^#) Try it online! Accepts numeric lists The maximum number of iterations until we return to the input is bounded by Landau'...
Jonah's user avatar
  • 33.6k
7 votes

Find the child anagrams of a word

JavaScript (ES6), 58 bytes -22 (!) thanks to @Neil Expects (dictionary)(word), where word is given as an array of characters. ...
Arnauld's user avatar
  • 193k
6 votes

Is this a Permutation of 1..n

BitCycle -u, 91 bytes ...
DLosc's user avatar
  • 39.7k
6 votes

First odd then even indices

Jelly, 6 bytes ŒœẎ$ƬL Try it online! Don't worry, the stack languages with single-byte uninterleave operators are going to be even shorter :P ...
Unrelated String's user avatar
6 votes

Numbers with distinct decimal digits

J, 14 bytes ~.~.@":&>i.!14 Attempt This Online! (with 7 instead of 14) Uses xnor's idea: take unique digits from each number and then take unique ...
Bubbler's user avatar
  • 77k
5 votes

Count N-Rich Permutations of an Integer Sequence

Thunno 2 L, 10 bytes qæƑœØ^ḷG¹= Try it online! or verify all test cases Explanation ...
The Thonnu's user avatar
  • 18.1k
5 votes

Count N-Rich Permutations of an Integer Sequence

JavaScript (ES6), 87 bytes Expects (n)(array). ...
Arnauld's user avatar
  • 193k
5 votes

Count N-Rich Permutations of an Integer Sequence

Ruby, 85 79 77 bytes Misread the prompt at first and was returning the permutations themselves instead of the amount, whoops. ...
Value Ink's user avatar
  • 12.6k
5 votes

Count N-Rich Permutations of an Integer Sequence

Wolfram Language (Mathematica), 62 57 bytes Port of @chunes's Factor code in Mathematica. Saved 5 bytes thanks to the comment of @ZaMoC Golfed version. Try it online! ...
138 Aspen's user avatar
  • 5,991
5 votes

First odd then even indices

05AB1E, 8 bytes vDÅ≠})Ùg Try it online or verify all test cases (the test suite uses the faster alternative ι˜ instead of ...
Kevin Cruijssen's user avatar
5 votes

First odd then even indices

Google Sheets, 107 bytes =let(d,torow(A:A,3),_,lambda(_,a,n,sort(let(b,torow(wrapcols(a,2),3),if(and(b=d),n,_(_,b,1+n))))),_(_,d,1)) Put the input in cells ...
doubleunary's user avatar
  • 1,705
5 votes

Numbers with distinct decimal digits

05AB1E, 5 4 bytes ∞€ÙÙ Outputs an infinite list. Try it online. Explanation: ...
Kevin Cruijssen's user avatar
4 votes

Count N-Rich Permutations of an Integer Sequence

Python, 126 bytes -19 bytes thanks to @ValueInk and @TheThonnu +2 bytes, index was off by one ...
bsoelch's user avatar
  • 6,025
4 votes

First odd then even indices

Python, 65 bytes lambda s,j=1:j*((t:=s[:len(s)-1|1])==(t*2**j)[::2**j])or f(s,j+1) Attempt This Online! How? This is based on the observation that in zero-based ...
loopy walt's user avatar
  • 16.7k
4 votes

First odd then even indices

Nekomata + -n, 6 bytes ᶦ{ĭ,ᵖ≠ Attempt This Online! Nekomata has a single-byte uninterleave operator, but still can't beat Jelly,...
alephalpha's user avatar
  • 48.5k
4 votes

First odd then even indices

Vyxal l, 31 bitsv2, 3.875 bytes yJ)↲ Try it Online! the stack languages with single-byte uninterleave operators are going to ...
lyxal's user avatar
  • 33.6k
4 votes

First odd then even indices

Excel, 93 bytes Define: a as =$A$1# (7 bytes) z as ...
Jos Woolley's user avatar
  • 1,942
4 votes

First odd then even indices

R, 70 bytes f=\(x,l=0,y=c(x[!0:1],x[!1:0]),`-`=list)`if`(-y%in%l,0,1+f(y,c(l,-y))) Attempt This Online!
Dominic van Essen's user avatar
4 votes

First odd then even indices

Ruby, 55 bytes ->l{k=*l;1.step.find{w=-2;l==k=k.map{k[w+=2]||k[w=1]}}} Try it online!
G B's user avatar
  • 22.1k
4 votes

First odd then even indices

R, 54 52 51 bytes Edit: -3 bytes thanks to @Dominic van Essen. \(x,y=x){while(sd((y[]=matrix(y,2,,T))-x))T=T+1;+T} Attempt This Online!
pajonk's user avatar
  • 16.7k
4 votes

Numbers with distinct decimal digits

K (ngn/k), 12 bytes .'??'$!_1e10 Try it online! (with 1e3 instead of 1e10) Uses xnor's idea: take unique digits from each number and then take unique results of ...
Bubbler's user avatar
  • 77k
3 votes

Count N-Rich Permutations of an Integer Sequence

Jelly, 13 bytes Œ!Ẇ<ƝẠ$ƇṪLƲ€ċ A dyadic Link that accepts the list of elements, \$L\$, on the left and the number, \$n\$, on the right and yields the count of \$...
Jonathan Allan's user avatar
3 votes

Count N-Rich Permutations of an Integer Sequence

Jelly, 13 bytes Œ!ẆIRẠƊƇẈṀƲ€ċ Try it online! -1 byte thanks to Jonathan Allan! Footer runs each sequence test case over a provided \$N\$ Jelly (fork), 10 bytes <...
caird coinheringaahin g's user avatar
3 votes

Count N-Rich Permutations of an Integer Sequence

Factor + math.combinatorics, 83 72 bytes [ <permutations> [ [ < ] monotonic-split longest length = ] with count ] ...
chunes's user avatar
  • 24.7k
3 votes

Golf you an anagram for great good!

Vyxal D, 14 bytes `q‛:Ė+:Ṗ$o℅`:Ė Try it Online! For a version that doesn't require ~1.2TB of RAM: Vyxal ...
emanresu A's user avatar
  • 38.8k
3 votes

Manage Trash So

Arturo, 33 bytes $=>[=do map&=>[tally--lower&` `]] Try it! Takes input as a list of two strings. ...
chunes's user avatar
  • 24.7k

Only top scored, non community-wiki answers of a minimum length are eligible