New answers tagged integer
3
votes
Output the sign
Trilangle, 21 bytes
?\<'1(0@'^\.!_@>'0.(#
Try it in the online interpreter!
Unfolds to this:
...
- 1,768
1
vote
Output the sign
Thunno, 2 bytes
za
Attempt This Online!
Built-in. Works on lists.
Thunno D, 3 bytes
ZA,
...
- 9,121
1
vote
Collapse consecutive integers
Vyxal, 23 bytes
D0J¨pε⁽ṅḋ•ƛL⁰≥[₍ht\-Y}f
Try it Online!
23 bytes seems to be the standard here, so I figured I'd add my own 23 byter. Takes ...
- 27.6k
0
votes
As Easy as One-Two-Three
Thunno, \$ 8 \log_{256}(96)\approx \$ 6.58 bytes
dz[11dA=
Attempt This Online!
Port of Emigna's 05AB1E answer.
- 9,121
0
votes
1
vote
0
votes
Stay away from zero
Pyt, 3 bytes
1←↑
Try it online!
1 push 1
← get input
↑ get maximum value on the stack; implicit print
- 1,169
3
votes
A Fine sequence with fine interpretations
Jelly, 7 bytes
~cŻÄÆmA
This calculates abs(mean(cumsum(choose(-n-1, [0..n])))).
Try it online!
The "negative binomial ...
- 67k
4
votes
A Fine sequence with fine interpretations
Python 2, 49 bytes
Prints the sequence indefinitely.
x=c=n=1
while 1:print x;n+=1;c=c*4-c*6/n;x=c-x>>1
Try it online!
Based on the Sage program at the end ...
- 20.4k
1
vote
A Fine sequence with fine interpretations
Pyt, 32 bytes
Đ⁺Đř⁻ĐĐ05Ș↔+2ř*⇹ɐ-Á⇹ć⇹⁺*⇹1~⇹^·⇹/
Try it online!
Naive implementation of the formula in the question.
The following walkthrough of the code is worked ...
- 1,169
2
votes
A Fine sequence with fine interpretations
Factor + koszul math.combinatorics, 69 bytes
[ 4 dupn + [a,b] [ -1^ -rot nCk * ] with map-index cum-sum mean abs ]
Try it ...
- 16.7k
1
vote
A Fine sequence with fine interpretations
Charcoal, 25 bytes
⊞υ¹≔¹θFN≔⊘⁻↨⊞OυΣ×⮌υυ⁰θθIθ
Attempt This Online! Link is to verbose version of code. Explanation:
⊞υ¹
Start ...
- 156k
4
votes
A Fine sequence with fine interpretations
Jelly, 12 11 bytes
ḤrcµJNÐeḋ:L
Try it online!
Port of emanresu A's golf to mathcat's Vyxal solution.
...
- 18.1k
6
votes
A Fine sequence with fine interpretations
Vyxal, 22 10 7 bytes
-12 bytes by emanresu A (double welp)
-3 bytes by alephalpha using a clever approach
ꜝ$ʀƈ¦ṁȧ
Try it Online!
How it works
...
- 7,457
4
votes
A Fine sequence with fine interpretations
05AB1E, 22 21 14 bytes
xŸIc2Å€(}ηOÅAÄ
Port of @mathcat's Vyxal answer, so make sure to upvote him as well!
Uses the formula: $$G_{n,k} = (-1)^{(k+1)}\binom{k}{n} + ...
- 116k
4
votes
A Fine sequence with fine interpretations
Python 3, 61 bytes
f=lambda n,v=1:sum(f(i,0)*f(n+~i,v)for i in range(v,n))or 1-n
Try it online!
JavaScript (Node.js), 50 bytes
...
- 32.8k
3
votes
A Fine sequence with fine interpretations
PARI/GP, 36 bytes
n->Vec(2/(1+2*x+sqrt(1-4*x+O(x^n))))
Attempt This Online!
Using the generating function.
PARI/GP, 39 bytes
...
- 41.8k
5
votes
A Fine sequence with fine interpretations
HOPS, 19 bytes
C=1+x*C^2;C/(1+x*C)
Attempt This Online!
The generating function of the Catalan numbers satisfies \$C(x)=1+x\ C(x)^2\$. The generating function of ...
- 41.8k
1
vote
Moving modest minimum
Desmos, 26 bytes
f(x)=x.sort[1+0^{x-x.min}]
Try it on Desmos!
Port of this answer.
- 2,750
4
votes
A Fine sequence with fine interpretations
Desmos, 46 41 bytes
f(n)=-∑_{k=1}^n(-1)^kknCr(2n-k-1,n-k)/n
A port of the explicit formula but with one-indexing instead of zero-indexing.
Try It On Desmos!
Try It ...
- 11.2k
6
votes
A Fine sequence with fine interpretations
Python 2, 58 bytes
i=a=1;b=0
while 1:print a;i+=1;a,b=2*b+7*a/2-(2*a+b)*3/i,a
Try it online!
Prints the sequence endlessly. The method substitutes \$C_n = 2F_n + ...
- 13.7k
4
votes
A Fine sequence with fine interpretations
JavaScript (ES6), 48 bytes
Returns the \$n\$-th term (0-indexed).
Inspired by the Catalan recurrence pointed out by Sisyphus.
...
- 179k
1
vote
1
vote
0
votes
N-dimensional N^N array filled with N
Arturo, 20 bytes
$=>[@.of:@.of:<=<=&]
Try it
Huh?
In Arturo, you can initialize a block of values like this:
...
- 16.7k
Top 50 recent answers are included
Related Tags
integer × 416code-golf × 387
number × 113
math × 90
sequence × 85
arithmetic × 57
array × 46
decision-problem × 33
string × 28
number-theory × 25
primes × 18
matrix × 18
binary × 17
ascii-art × 13
code-challenge × 13
base-conversion × 13
geometry × 9
bitwise × 9
kolmogorov-complexity × 8
sorting × 8
fastest-code × 8
fibonacci × 8
division × 8
random × 7
subsequence × 7