New answers tagged

0 votes

Generate a Kirkman triple system

Python with numpy, 285 bytes from numpy import* def k(q): t=q//6;a=array;r=range;R=a(r(q-1));X=R//t%2;h=a(r(3));g=1;p=lambda x:[(x+s)%q for s in r(q)] while 1in g**R[1:]%q:g+=1 A=a([g**(i+...
user avatar
1 vote

How many partitions do I have?

Desmos, 64 bytes p(n)=1+∑_{i=1}^{n^n}0^{(n-∑_{j=1}^njmod(floor(ni/n^j),n))^2} Try it on Desmos! This is O(n^(n+1)) How it works ...
user avatar
1 vote

Generate a Kirkman triple system

PARI/GP, 218 bytes ...
user avatar
  • 36.1k
1 vote

Cryptic Multiplications

Python 3, 128 bytes ...
user avatar
1 vote

Cryptic Multiplications

Charcoal, 36 bytes FXχLθFEXχLη⪫⟦ικ×ικ⟧¶⊞υEκ⌕κλI№υ§υI⁺θη Try it online! Link is to verbose version of code. Explanation: FXχLθ ...
user avatar
  • 146k
3 votes

Cryptic Multiplications

05AB1E, 20 bytes €g°Ý`âIšεDPª»DSk»}ć¢ Port of @Steffan's Vyxal answer, but with less convenient builtins. Try it online or verify (almost) all test cases (the last ...
user avatar
1 vote

Cryptic Multiplications

Ruby, 108 bytes ->a,b{[*0..9].permutation.map{|c|"#{a}*#{b}==#{a*b}".tr('0-9',c*'')}.uniq.count{|c|/^0|\*0|=0/!~c&&eval(c)}} Try it online!
user avatar
  • 18.3k
4 votes

Cryptic Multiplications

Knight, 416 219 bytes ...
user avatar
  • 9,066
4 votes

Cryptic Multiplications

Vyxal s, 17 bytes vL↵ʀΠƛ?"ƛΠJṄ:vḟ;≈ Try it Online! This would flaglessly be 19 bytes. It can be shorter flagless, though: ...
user avatar
  • 9,066
3 votes

Cryptic Multiplications

Jelly,  20 18  17 bytes Thanks to Steffan for a speed up! (‘×⁵ -> æċ⁵) and a byte that ended up saving elsewhere! Save of 2 ...
user avatar
7 votes

Cryptic Multiplications

K (ngn/k), 41 36 bytes -5 bytes inspired by Jonathan Allan's answer. {#*={.(=`k@x,*/x)_" "}'?+x,'!10*1+x} Try it online! The last 4 cases are too slow to ...
user avatar
  • 55k
3 votes

Cryptic Multiplications

JavaScript (ES6),  127  120 bytes Expects (p)(q), as strings. ...
user avatar
  • 169k
1 vote

How many partitions do I have?

Jelly, 5 bytes ŻṗḋRċ Try it online! Non-builtin solution using Henry Bottomley's comment at the top of the OEIS page. Although this obviously doesn't beat the ...
user avatar
0 votes

Calculate the partitions of N

Curry (PAKCS), 44 bytes (1!) _!0=[] a!n=anyOf[a ..n]#n a#n=a:a!(n-a) Try it online!
user avatar
  • 36.1k
1 vote

Calculate the partitions of N

Vyxal, 7 bytes ɾÞ×'∑?= Try it Online! ...
user avatar
  • 9,066
1 vote

How many partitions do I have?

Vyxal l, 1 byte Try it Online! Vyxal, 2 bytes ṄL Try it Online!
user avatar
  • 9,066
1 vote

Sum of combinations with repetition

Vyxal, 9 bytes ⁺¤fẋfṗUṠO Try it Online! The header in the link halves the input to make things faster. It will return the same result if you remove it, but it may ...
user avatar
  • 9,066
0 votes

Sum of combinations with repetition

Regex 🐇 (ECMAScriptRME / Perl / PCRE / Raku:P5), 14 bytes ^(xxx?|x{5})*$ Takes its input ...
user avatar
  • 9,610
0 votes

Calculate the partitions of N

05AB1E, 8 bytes Å1.œO€{ê Outputs as a list of lists, from n amount of 1s to [n], where each ...
user avatar
1 vote

How many partitions do I have?

05AB1E, 3 bytes Åœg Try it online or verify all test cases. Explanation: ...
user avatar
1 vote

Restricted Integer Partitions

Vyxal, 5 bytes ṄvL=∑ Try it Online! Jelly, 5 bytes ŒṗẈ=S Try it online! Dang it, ninja'd by Kevin because I took the time to ...
user avatar
  • 22.4k
2 votes

Restricted Integer Partitions

05AB1E, 5 bytes ÅœIùg Try it online or verify all test cases. Explanation: ...
user avatar
3 votes

How many partitions do I have?

Regex 🐇 (RME / Perl / PCRE2 v10.35+ / Raku:P5), 13 bytes ^(\1x*|^x+)*$ Try it on replit....
user avatar
  • 9,610
1 vote

Restricted Integer Partitions

Regex 🐇 (Perl/PCRE+(?^=)RME), 32 28 bytes ^((?^=(\2?x))(\1|^x)x*)+,\2$ Try it on replit....
user avatar
  • 9,610
1 vote

Generate number set with conditions using n numbers

Python, 168 165 bytes from itertools import* def f(n,k,v): c,r,i=combinations,range(n),0 while i:=i+1: for t in c(c(r,k),i): if not{*c(r,v)}-{*chain(*[c(s,v)for s in t])}:return t Attempt This ...
user avatar
  • 1,431
2 votes

Generate number set with conditions using n numbers

JavaScript (ES10), 188 bytes Another brute-force solution that is unlikely to solve the second test case before the heat death of the universe. Results are 0-indexed. ...
user avatar
  • 169k
2 votes

Generate number set with conditions using n numbers

Vyxal, 14 bytes ɾḋṗṘµ⁰vḋÞfUL;t Try it Online! Basically a port of Jelly, aka extremely slow. Explanation coming soon.
user avatar
  • 9,066
3 votes

Generate number set with conditions using n numbers

Jelly, 15 bytes œcŒPṚœc€⁵ẎQLƲÞṪ A full program that accepts alphabet size (n), block size (k), and subset size (v) and prints a minimum covering design. Try it ...
user avatar

Top 50 recent answers are included