New answers tagged

0 votes

Complete a sequence using its distances

Uiua SBCS, 14 bytes ⍥(◴⊂:⌵↘1°\+.)∞ Try it! ...
chunes's user avatar
  • 23.4k
1 vote

Enumerate the Phat-fingered-lights-out numbers

Scala 3, 212 bytes A port of @Arnold Palmer's Python answer in Scala. Golfed version. Attempt This Online! ...
138 Aspen's user avatar
  • 5,341
1 vote

Enumerate the Phat-fingered-lights-out numbers

C (gcc), 107 92 bytes -15 thanks to @ceilingcat for much smarter for loop utilization ...
Arnold Palmer's user avatar
2 votes

Enumerate the Phat-fingered-lights-out numbers

Python 3, 107 bytes f=lambda n,i=0,l=[]:i-1if n==sum(l)else f(n,i+1,l+[a(i,2)==a(i,3)]) a=lambda n,s:sum(map(int,bin(n)[s::2])) Try it online! Uses the same logic ...
Arnold Palmer's user avatar
1 vote

Enumerate the Phat-fingered-lights-out numbers

05AB1E, 7 bytes ∞<ʒb®ö_ Outputs a lazy infinite list. Try it online. Or: [Nb®ö_– Infinitely outputs all results on a ...
Kevin Cruijssen's user avatar
3 votes

Enumerate the Phat-fingered-lights-out numbers

x86 32-bit machine code, 23 bytes 83 C8 FF 40 BA AA AA AA AA 31 C2 F3 0F B8 D2 83 FA 10 75 EF E2 ED C3 Try it online! Following the ...
m90's user avatar
  • 10.1k
2 votes

Enumerate the Phat-fingered-lights-out numbers

Haskell + hgl, 20 bytes fl(qb sm<%uak<bs2)nn Attempt This Online! Explanation We convert the list to base 2, split it into digits in an even position and ...
Wheat Wizard's user avatar
  • 97.6k
2 votes

Enumerate the Phat-fingered-lights-out numbers

J, 23 21 bytes {.(#~0=-/"1@#:)@i.@*: Try it online! Uses Tbw's observation and is basically a port of Mukundan314's APL answer
Jonah's user avatar
  • 33.3k
2 votes

Enumerate the Phat-fingered-lights-out numbers

APL+WIN, 29 37 bytes +8 bytes as it appears my original answer of outputting the series up to a given value was outside the rules. Prompts for number of values to output. Index origin = 0 ...
Graham's user avatar
  • 5,866
4 votes

Enumerate the Phat-fingered-lights-out numbers

APL(Dyalog Unicode), 18 bytes SBCS Requires Index Origin 0 (...
Mukundan314's user avatar
  • 8,204
5 votes

Enumerate the Phat-fingered-lights-out numbers

Charcoal, 23 19 16 bytes NθI…Φ×θθ¬↨↨ι²±¹θ Try it online! Link is to verbose version of code. Outputs the first n terms. ...
Neil's user avatar
  • 169k
6 votes

Enumerate the Phat-fingered-lights-out numbers

Jelly, 6 bytes Bḅ-¬µ# A full program that accepts a positive integer, n, on stdin and prints the first ...
Jonathan Allan's user avatar
10 votes

Enumerate the Phat-fingered-lights-out numbers

Uiua 0.9.0, 14 bytes SBCS (updated!) ↙:▽=0/-⍉⋯.⇡×.. Try on Uiua Pad! Takes \$n\$ as input and outputs the first \$n\$ terms. Does essentially the same thing as my ...
Tbw's user avatar
  • 1,139
5 votes

Enumerate the Phat-fingered-lights-out numbers

JavaScript (V8), 45 bytes A full program that prints the sequence indefinitely. This relies on arithmetic underflow to stop the recursion, making it slower than it should (+1 byte for a faster version)...
Arnauld's user avatar
  • 191k
1 vote

Say What You See

YASEPL, 132 bytes ...
madeforlosers's user avatar
0 votes

The first n numbers without consecutive equal binary digits

YASEPL, 39 bytes =n=a'(`1!b$2^n-*/3!s$b(}5,b,2+`2<!+}2,a explanation: ...
madeforlosers's user avatar
0 votes

Alternating Sign Sequence

Vyxal, 52 bitsv2, 6.5 bytes Þn2ẇ0Zfi Try it Online! Bitstring: 0010101100100111101111111101010011100010011001000000 Silly ...
pacman256's user avatar
  • 3,330
1 vote

The first n numbers without consecutive equal binary digits

Labyrinth, 22 bytes 1?+:_ }: 3 " !/ @({\ Try it online! Uses the "power of 2 divided by 3" formula. ...
Bubbler's user avatar
  • 75k
0 votes

Lolololololololololololol

Rust, 41 bytes fn main(){print!("L");loop{print!("ol")}} Try it online!
Joonas's user avatar
  • 11
0 votes

Repeated Consecutive Digital Product Sum Convergence

Uiua SBCS, 20 17 bytes ⍥(/+⊜/×+1.-@0°⋕)∞ Try it!
chunes's user avatar
  • 23.4k
1 vote

Different Way Forward

Vyxal, 2 bytes Try it Online! ( # n times ¯ # take forward differences
emanresu A's user avatar
  • 37.1k
1 vote

Repeated Consecutive Digital Product Sum Convergence

Vyxal 3 g, 6 bytes ᵡλġᵛΠ∑ Try it Online!
pacman256's user avatar
  • 3,330
0 votes

Lolololololololololololol

YASEPL, 11 bytes #"L"#"ol"?2
madeforlosers's user avatar
0 votes

Lolololololololololololol

Perl 5, 25 bytes print"L";print'ol'while 1 Try it online!
Xcali's user avatar
  • 14.2k
0 votes

Lolololololololololololol

Hussy.Net, 17 bytes A("L");R(A,"ol"); A is an append function that simply writes the specified input to ...
Hazel へいぜる's user avatar
2 votes

Different Way Forward

Uiua SBCS, 8 bytes ⍥(↘1°\+) Try it!
chunes's user avatar
  • 23.4k
0 votes

One OEIS after another

407. Dart, 373 bytes, A000198 ...
enzo's user avatar
  • 1,943
0 votes

Next Greater Number

YASEPL, 66 bytes =a'(+`1=1)aſ""=h®1=d`2!c¥d,1!f$d+!g¥f,1}2,c,5!d+}2,h,2|6`5!+|`6>a explanation: ...
madeforlosers's user avatar
1 vote

Binary Countdown Length

Go, 172 bytes ...
bigyihsuan's user avatar
  • 9,128
1 vote

Binary Countdown Length

Vyxal 3 s, 3 bytes ½⊻b Try it Online! port of the jelly answer
pacman256's user avatar
  • 3,330
1 vote

Print numbers from 1 to 10

YASEPL, 10 bytes =a`1+<}4,9
madeforlosers's user avatar
1 vote

Fibonacci function or sequence

Labyrinth, 13 bytes 1 :!\ { : =+} Try it online! Infinitely prints fibonacci numbers separated by newlines. ...
Bubbler's user avatar
  • 75k
0 votes

Count up folks!

Rattle, 9 bytes |!s=[+p]~ Try it Online! Explanation ...
Daniel H.'s user avatar
  • 3,328
0 votes

Print numbers from 1 to 10

Rattle, 6 bytes [+p]10 Try it Online! Loop 10 times while incrementing and printing each time
Daniel H.'s user avatar
  • 3,328
0 votes

Print numbers from 1 to 10

Uiua SBCS, 5 bytes +1⇡10 Try it!
chunes's user avatar
  • 23.4k
2 votes

Print numbers from 1 to 10

Labyrinth, 14 bytes 9:" (" !) \"@ Try it online! Prints 1 to 10 separated and terminated by newlines. ...
Bubbler's user avatar
  • 75k
1 vote

Alternating Random Series Sum To \$N\$

Pyth, 20 bytes s+V*"+-"QOf!u-HGTQ^S Try it online! Explanation ...
CursorCoercer's user avatar
2 votes
Accepted

Alternating Random Series Sum To \$N\$

Jelly, 15 bytes ṗḅ-⁼ɗƇ⁸XṚṭNƭ€”+ A full program that accepts a positive integer, \$n\$, and prints a possible alternating sum, in the given format, with \$n\$ terms ...
Jonathan Allan's user avatar
1 vote

Alternating Random Series Sum To \$N\$

Charcoal, 25 bytes NθW⁻↨⮌υ±¹θ≔Eθ⊕‽θυ⭆υ⁺§+-κι Try it online! Link is to verbose version of code. Explanation: Nθ Input ...
Neil's user avatar
  • 169k
1 vote

Alternating Random Series Sum To \$N\$

05AB1E, 19 bytes L¤ãε(2Å€Ä'+ì]ʒOQ}ΩJ Try it online or verify all possible results for a given input. ε(2Å€Ä'+ì] could ...
Kevin Cruijssen's user avatar
2 votes

Double-reduce a sequence of integers

05AB1E, 10 bytes Î¥vDyα‚˜}¦ Inspired by @Neil's Charcoal answer. Try it online or verify all test cases. Explanation: ...
Kevin Cruijssen's user avatar
1 vote

Alternating Random Series Sum To \$N\$

Google Sheets, 154 bytes Assuming \$n\$ is in \$A1\$ ...
z..'s user avatar
  • 331
1 vote

Alternating Random Series Sum To \$N\$

Python 3.8 (pre-release), 120 bytes from random import* def f(n): while sum(L:=[s*randint(1,n)for s in(1,-1)*n][:n])-n:1 return''.join('%+d'%v for v in L) Try ...
enzo's user avatar
  • 1,943
1 vote

Alternating Random Series Sum To \$N\$

JavaScript (ES6), 74 bytes f=(n,i,s)=>i^n?f(n,-~i,[s]+"+-"[i&1]+-~(Math.random()*n)):eval(s)-n?f(n):s Try it online! Commented ...
Arnauld's user avatar
  • 191k
0 votes

Alternating Random Series Sum To \$N\$

C (gcc), 118 112 bytes -6 bytes, thanks to @Arnauld ...
vengy's user avatar
  • 1,613
1 vote

Can even numbers become prime?

Vyxal, 6 bytes '‹Jæ;L Try it Online! ...
emanresu A's user avatar
  • 37.1k
2 votes

Double-reduce a sequence of integers

Haskell, 48 bytes r a[_]=a r a(x:y:l)=r(a++[y-x-z|z<-0:a])$y:l r[]
Victor's user avatar
  • 31
6 votes

Double-reduce a sequence of integers

Charcoal, 24 bytes ⊞υ⁰FEΦθκ⁻ι§θκ≔⁺υ⁻ιυυIΦυκ Try it online! Link is to verbose version of code. Explanation: Adapted from both @Arnauld's and @loopywalt's answers. <...
Neil's user avatar
  • 169k
5 votes

Double-reduce a sequence of integers

Python, 63 bytes f=lambda l,*L,a=[]:L and f(*L,a=a+[L[0]-l-b for b in[0]+a])or a Attempt This Online! Takes splatted input. Returns the entire double-reduction. ...
loopy walt's user avatar
  • 16.6k
1 vote

Binary Expansion Counting Sequence

Python 3.8 (pre-release), 79 75 bytes Calculates the first n terms, zero indexed. ...
movatica's user avatar
  • 1,025

Top 50 recent answers are included