# Tag Info

Accepted

### Weighted coin flip strings

05AB1E, 40 39 18 17 bytes Brute-force approach: 0Lα1Ý²ãʒγOà³@}èPO Byte-count more than halved by porting @JonathanAllan's Jelly answer, which uses a similar ...

### Implement Binary Exponentiation

Vyxal, 6 bytes d‡½⌊İe Try it Online! Takes inputs in reverse order. Explanation ...

### Print the power set of the power set ... of an empty set

Burlesque, 8 bytes {}1qR@C~ Try it online! ...
Accepted

### Print the power set of the power set ... of an empty set

Jelly, 3 bytes ŒP¡ Attempt This Online! Using standard I/O rules; takes input from STDIN Explanation: ...

### Weighted coin flip strings

Jelly,  19  15 bytes Ø.ṗṣ1ZṫɗƇ_⁵AP€S A full program accepting n, k, and ...

### Weighted coin flip strings

Python, 66 bytes (-1 @xnor) f=lambda n,k,p:n>=k and(1-p*(n>k))*(1-f(n+~k,k,p))*p**k+f(n-1,k,p) Attempt This Online! Adapted from my answer to a similar challenge. Note that I add memoization in ...

### Print the power set of the power set ... of an empty set

Wolfram Language (Mathematica), 19 bytes Nest[Subsets,{},#]& Try it online! In the notebook interface, the results are printed without spaces. But in TIO or ...

### Print the power set of the power set ... of an empty set

Vyxal, 4 bytes or 12 ¾?(ṗ Explanation ...

### Print the power set of the power set ... of an empty set

Python, 96 bytes from itertools import* f=lambda n:n and(chain(*(combinations(f(n-1),r)for r in range(n+1))))or() Attempt This Online!

Haskell, 53 bytes f=(!!)$iterate(\l->init l++[','|l/="{}"]++l++"}")"{}" Try it online! My first golf. Nothing particularly clever,... 5 votes ### Weighted coin flip strings R, 129 122 116 bytes Edit: -2 bytes thanks to pajonk (which led to -4 more...) ... 4 votes ### Is this polynomial a square? Vyxal, 33 32 bytes h√d£0¾ȦλȮḂÞ•-¥/J;RI÷?₂J†^¥J:⌊=JA Try it Online! –1 per emanresu A. How? We find the square root of the polynomial using its power series, ... 4 votes ### Print the power set of the power set ... of an empty set Pyth, 3 or 17 11 bytes yFY Try it online! F - Repeat Q times, where Q is the implicit input: ... 4 votes ### Divide by an odd number, 2-adically Python, 45 bytes lambda a,b,n:(a-~a)*pow(b-~b,-1,2<<n)//2%2**n Attempt This Online! Beginning with Python 3.8 the builtin pow can directly compute the modular ... 4 votes ### Weighted coin flip strings JavaScript (ES7), 106 bytes Quickly computes the probability, using the formula found by Kevin Cruijssen. ... 4 votes ### Weighted coin flip strings Vyxal , 23 bytes 2$ÞẊ'2€vLG›¹>;⁰⌐⁰"$İvΠ∑ Try it Online! Port of Jelly. Really slow. Previous answer (much faster): ... 4 votes ### Weighted coin flip strings PARI/GP, 53 bytes k->p->g(n)=if(n>=k,p^k*(1-p*(n>k))*(1-g(n---k))+g(n)) Attempt This Online! A port of loopy walt's Python answer. Takes input in the ... 3 votes ### Finite Field Multiplication Jelly, 22 bytes Bæc/ḣ-64æcB}ʋƬUSḣ64UḂḄ Try it online! Works either as a function or a full program. This takes two arguments: a 2-element list ... 3 votes ### One OEIS after another 373. Idris, 907 bytes, A000170 ... 3 votes ### Landau logarithm Haskell, 68 67 bytes k%n=sum[1+k?n%n|k?n>k] k?n=maximum$k:[lcm x$k?(n-x)|x<-[1..n]] (1%) Try it online! Golfs 2 bytes ... 3 votes ### Semidivisibility Vyxal v2.6.0+, 6 bytes ġ/₀KḢc Takes its input as $k$ followed by $n$. Try it Online! This uses the same algorithm as my regex answer, which is similar to the ... 3 votes ### Is this polynomial a square? Wolfram Language (Mathematica), 58 68 64 55 bytes thanks @Steffan for the byte correction, and the suggestions thanks @alephalpha ... 3 votes ### Print the power set of the power set ... of an empty set 05AB1E (legacy), 4 or 17 bytes Regular I/O using [] instead of {} and spaces after the commas would be 4 bytes: ... 3 votes ### Divide by an odd number, 2-adically PARI/GP, 32 bytes f(a,b,n)=(2*a+1)/(2*b+1)%2^n++\2 Attempt This Online! PARI/GP has a built-in p-adic type, but using the % ... 3 votes ### Divide by an odd number, 2-adically C (gcc), 48 bytes c;i;f(a,b){for(i=32;i;--i)c=a-b-2*b*c;return c;} Try it online! Explanation: since $(2b+1) (2c+1) = 2(2bc+b+c)+1$ should end up equal to \$2a+...

Vyxal, 21 bytes ƛ.0*Ẏ⌊øṘṅøṘ;∑øṘvøṘṅ Try it Online! How? ...

### Weighted coin flip strings

PARI-GP, 75 bytes Port of below solution (can run n ~ 1000000000, k ~ 150) f(n,k,p)=(matrix(k++,k,a,b,(a-1==b)*p+(a<2)*(b<k)*(1-p)+(a+b==k+k))^n)[k,1] Python ...

### Implement Binary Exponentiation

PARI/GP, 34 bytes f(x,n)=[x^m\=2|i<-binary(m=2*n+1)] Attempt This Online! PARI/GP, 29 bytes f(a,n)=if(n,f(a,n\2)*x+a^n,1) ...