Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
An answer-chaining challenge is a challenge where previous answers to the challenge influence how new answers are produced.
6
votes
One OEIS after another
69. GAP, 333 bytes, A000761
dirs:=[[1,0,0],[0,1,0],[0,0,1]];
dirs:=Concatenation(dirs,-dirs);
count:=function(pos,seen,n)
local newseen;
if (pos in seen) or AbsInt(pos[1]-2)>n then
return 0; …
4
votes
One OEIS after another
114. Crystal, 1560 bytes, A000228
Dirs = [0,1,-1].permutations.to_a
def addhp(a,b)
(0..2).map{ |i| a[i]+b[i] }
end
def hexh(n,use,seen,possible)
if n==0
testhex(use) ? 1 : 0
else
if p …
2
votes
One OEIS after another
118. Ly, 128 bytes, A000106
1<n
[>&sy0>lr>l
[&s>lrysp>l[:lf%:[pp0f10]p![p:0]p1-]p
<<<0>>[sp>l*sp<<<l+>>]
<p<*sp<l+>>]
<<f/<1-]
>&s>lr[sp<l*sp<l+>>]<<u
Next sequence
Try it online!
Easy: jus …
3
votes
One OEIS after another
122. MIT/GNU Scheme, 2057 bytes, A000525
So I'm implementing A000081 again...
(define (add f g)
(stream-map + f g) )
(define (scale c f)
(stream-map (lambda (v) (* c v)) f) )
(define (adddiag …
6
votes
One OEIS after another
178. GAP, 933 bytes, A000214
Luckily GAP wasn't taken for No. 167 (A000638)!
AG := function( n )
local b, sw, sh, xr, tr, gens;
b := BasisVectors(Basis(FullRowSpace(GF(2),n+1)));
gens := [];
…
7
votes
One OEIS after another
191. Haskell, 1824 bytes, A000725
import Data.List (sort, group, permutations)
import Control.Monad (replicateM)
import qualified Data.Set as S
import qualified Data.Map.Strict as M
type V = [Bool]
…
3
votes
One OEIS after another
224. Racket, 1232 bytes, A000088
#lang racket
(define (partsm n m)
(if (= n 0)
'(())
(for*/list ([k (range 1 (add1 (min n m)))]
[r (partsm (- n k) k)] )
(cons …
4
votes
One OEIS after another
236. Axiom, 341 bytes, A003295
qpc(n,k) == -- inspired by 3rd PARI code for A010815
qr := divide(n,k)
if qr.remainder>0 then return 0
sq := perfectSqrt(24*qr.quotient+1)
sq case "failed" => …
3
votes
One OEIS after another
243. Ly, 112 bytes, A000111
1<<<<111<n2-0G*
[
>&s0>l>lr>1>&s>lp
[
sp<l+sp<l>>
]
<p<1&s>l<
[
sp<l*sp<l*sp<l+>>>
]
<p<p<<,
]
p>u&p;
Try it online!
Next sequence
This uses the recurrence …
6
votes
One OEIS after another
253. MIT/GNU Scheme, 1516 bytes, A000251
(define (add f g)
(stream-map + f g) )
(define (sub f g)
(stream-map - f g) )
(define (scale c f)
(stream-map (lambda (v) (* c v)) f) )
(define (addd …
2
votes
One OEIS after another
329. Yacas, 155 bytes, A000222
/* compute the series A000222 with yacas */
f(n) := Sum(k,2,n,Bin(2*n-k,k) * (n-k)! * (-1)^k * Bin(k,2));
/* only the space between ! and * is necessary */
Put it in …
8
votes
One OEIS after another
250. Coconut, 711 bytes, A000171
from collections import Counter
from math import gcd, factorial
def sparts(n, m=4):
if n%2==1:
return [ [1] + p for p in sparts(n-1) ]
elif n==0:
return …
1
vote
Evolution of OEIS
Haskell, 32 bytes, depth 7, A018819 from A016116
l=1:zipWith(+)l(tail$l>>=(:[0]))
This defines an infinite list containing all the values.
As more easily readable function that (could be golfed so …