cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

User: Matt Frank

Matt Frank's wiki page.

Matt Frank has authored 5 sequences.

A348913 Number of N(0,1) variables needed for a 1/2 chance that their maximum exceeds the maximum of n N(1,1) variables.

Original entry on oeis.org

4, 11, 19, 29, 40, 52, 64, 78, 92, 106, 122, 137, 154, 171, 188, 205, 224, 242, 261, 280, 300, 320, 340, 360, 381, 402, 424, 446, 468, 490, 512, 535, 558, 581, 605, 629, 652, 677, 701, 726, 750, 775, 801, 826, 852, 877, 903, 929, 956, 982, 1009
Offset: 1

Author

Matt Frank, Nov 03 2021

Keywords

Comments

The above data has only 51 entries because the Mathematica code below would give numerically unstable results for the integrals with n>51.

Examples

			For n = 2, a(2) = 11 because if X_i are standard normal variables, and Y_j are normal variables with mean and variance 1, then P[max(X_1, ... X_10) > max(Y_1, Y_2)] = 49% but P[max(X_1, ... X_11) > max(Y_1, Y_2)] = 51%.
		

Programs

  • Mathematica
    cdf[x_] := CDF[NormalDistribution[], x];
    prob[m_] := NIntegrate[D[cdf[x]^m, x] cdf[x - 1]^n , {x, -Infinity, Infinity}]
    Table[FindArgMin[(prob[m] - 1/2)^2, {m, n^1.75}] // Ceiling, {n, 51}]

A330967 a(n) is the determinant of the matrix with elements gcd(i,j) for 2 <= i,j <= n.

Original entry on oeis.org

2, 5, 10, 44, 104, 656, 2624, 15744, 67584, 694272, 2777088, 34062336, 213221376, 1758855168, 14070841344, 228530847744, 1371185086464, 25007480635392, 200059845083136, 2447683608379392, 25040421692375040, 556525133318062080, 4452201066544496640, 89044021330889932800
Offset: 2

Author

Matt Frank, Jan 04 2020

Keywords

Comments

These determinants are always nonzero, as shown by Beslin and Ligh.

Crossrefs

A001088 gives the determinants for gcd(i,j), 1 <= i,j <= n.
A067549 gives the determinants for gcd(i-th prime, j-th prime), 1 <= i,j <= n.

Programs

  • Mathematica
    Table[Det[Table[GCD[i, j], {i, 2, n}, {j, 2, n}]], {n, 2, 25}]
  • PARI
    a(n)={matdet(matrix(n-1, n-1, i, j, gcd(i+1,j+1)))} \\ Andrew Howroyd, Jan 07 2020

A288416 Median of (2X-n)^2 + (2Y-n)^2 where X and Y are independent random variables with B(n, 1/2) distributions.

Original entry on oeis.org

2, 4, 2, 4, 10, 8, 10, 8, 10, 16, 18, 20, 18, 20, 26, 20, 26, 20, 26, 32, 26, 32, 34, 36, 34, 36, 34, 40, 34, 40, 50, 40, 50, 52, 50, 52, 50, 52, 50, 52, 58, 64, 58, 64, 58, 68, 58, 68, 74, 68, 74, 72, 74, 72, 82, 80, 82, 80, 82, 80, 82, 80, 90, 100, 90, 100
Offset: 1

Author

Matt Frank, Jun 09 2017

Keywords

Comments

Interpretation: Start at the origin, and flip a pair of coins. Move right one unit if the first coin is heads, and otherwise left one unit. Then move up one unit if the second coin is heads, and otherwise down one unit. This sequence gives your median squared-distance from the origin after n pairs of coin flips.
The mean of (2X-n)^2 + (2Y-n)^2 is 2n, or A005843.
A continuous analog draws each move from N(0,1) rather than from {+1,-1}, so the final x- and y- coordinates are distributed as N(0,sqrt(n)). Then the final point has probability 1 - exp(-r^2/2n) of being within r of the origin, and the median squared-distance for this continuous analog is n log(4). We also observe empirically that for this discrete sequence, a(n)/n approaches log(4).

Examples

			For n=3 the probabilities of ending up at the lattice points in [-3,3]x[-3,3] are 1/64 of:
1 0 3 0 3 0 1
0 0 0 0 0 0 0
3 0 9 0 9 0 3
0 0 0 0 0 0 0
3 0 9 0 9 0 3
0 0 0 0 0 0 0
1 0 3 0 3 0 1
So the squared-distance is 2 with probability 36/64, 10 with probability 24/64, and 18 with probability 4/64; the median squared-distance is therefore 2.
		

Crossrefs

Cf. A288347, which is similar, with shifted coordinates; and also A288346.

Programs

  • Mathematica
    Shifted[x_, n_] := (2 x - n)^2;
    WeightsMatrix[n_] := Table[Binomial[n, i] Binomial[n, j], {i, 0, n}, {j, 0, n}]/2^(2 n);
    ValuesMatrix[n_, f_] := Table[f[i, n] + f[j, n], {i, 0, n}, {j, 0, n}];
    Distribution[n_, f_] := EmpiricalDistribution[Flatten[WeightsMatrix[n]] -> Flatten[ValuesMatrix[n, f]]];
    NewMedian[n_, f_] :=
    Mean[Quantile[Distribution[n, f], {1/2, 1/2 + 1/2^(2 n)}]];
    Table[NewMedian[n, Shifted], {n, 66}]

A288347 Median of X^2 + Y^2 where X and Y are independent random variables with B(n, 1/2) distributions.

Original entry on oeis.org

1, 2, 5, 9, 13, 20, 25, 34, 41, 52, 61, 74, 85, 100, 116, 130, 149, 164, 185, 202, 225, 244, 269, 290, 317, 340, 369, 394, 425, 452, 485, 520, 549, 585, 617, 653, 689, 730, 765, 808, 845, 890, 929, 976, 1017, 1066, 1109, 1160, 1205, 1258, 1305, 1360, 1409
Offset: 1

Author

Matt Frank, Jun 08 2017

Keywords

Comments

Interpretation: Start at the origin, and flip a pair of coins. Move right one unit if the first coin is heads, and otherwise stay in place. Then move up one unit if the second coin is heads, and otherwise stay in place. This sequence gives your median squared-distance from the origin after n pairs of coin flips.
Although a median of integers can be a half-integer, as an empirical observation only integers appear in this sequence.
The mean of X^2 + Y^2 is (n^2+n)/2, or A000217.
From Robert Israel, Oct 04 2017: (Start)
To avoid the possibility of half-integer values, the median can be taken as the least integer v such that Probability(X^2 + Y^2 <= v) >= 1/2.
All terms are in A001481.
Using the Central Limit Theorem, 4*(X^2+Y^2)/n has approximately a noncentral chi-square distribution with 2 degrees of freedom and noncentrality parameter 2*n. Thus integral_{t=0..4*a(n)/n} exp(-n-t/2) BesselI(0,sqrt(2*n*t)) dt is approximately 1.
Since a random variable not too far from normal has median approximately mu - gamma*sigma/6 where mu, sigma and gamma are the mean, standard deviation and skewness, we should expect a(n) to be approximately n^2/2 + n/4.
(End)

Crossrefs

Cf. A288416, which is similar, with shifted coordinates; and also A288346, which is multiplicative rather than additive.

Programs

  • Maple
    f:= proc(n) local S,P,i,j,q;
      S:= sort( [seq(seq([i,j],i=0..n),j=0..n)],(a,b) -> a[1]^2 + a[2]^2 < b[1]^2 + b[2]^2);
      P:= ListTools:-PartialSums(map(t -> binomial(n,t[1])*binomial(n,t[2])/2^(2*n), S));
      q:= ListTools:-BinaryPlace(P,1/2);
      if P[q] = 1/2 then S[q][1]^2 + S[q][2]^2
      else S[q+1][1]^2 + S[q+1][2]^2
      fi
    end proc:
    map(f, [$1..80]); # Robert Israel, Oct 04 2017
  • Mathematica
    Squared[x_] := x^2;
    WeightsMatrix[n_] := Table[Binomial[n, i] Binomial[n, j], {i, 0, n}, {j, 0, n}]/2^(2 n);
    ValuesMatrix[n_, f_] := Table[f[i] + f[j], {i, 0, n}, {j, 0, n}];
    Distribution[n_, f_] := EmpiricalDistribution[Flatten[WeightsMatrix[n]] -> Flatten[ValuesMatrix[n, f]]];
    NewMedian[n_, f_] := Mean[Quantile[Distribution[n, f], {1/2, 1/2 + 1/2^(2 n)}]];
    Table[NewMedian[n, Squared], {n, 53}]

A288346 Median of 2^X + 2^Y where X and Y are independent random variables with B(n,1/2) distributions.

Original entry on oeis.org

3, 4, 6, 9, 12, 20, 24, 40, 64, 80, 128, 160, 256, 320, 528, 768, 1088, 1536, 2176, 3072, 4352, 6144, 9216, 12288, 18432, 32768, 36864, 65536, 73728, 131072, 163840, 264192, 327680, 532480, 655360, 1064960, 1310720, 2162688, 2621440, 4325376, 6291456, 8650752
Offset: 1

Author

Matt Frank, Jun 08 2017

Keywords

Comments

Interpretation: Start with a portfolio of stocks A and B each worth $1, and flip a pair of coins. Stock A doubles if the first coin is heads and otherwise stays constant. Stock B doubles if the second coin is heads and otherwise stays constant. This sequence gives your median portfolio value after n pairs of coin flips.
Although a median of integers can be a half-integer, as an empirical observation only integers appear in this sequence.
The mean of 2^X + 2^Y is 2(3/2)^n.

Crossrefs

Cf. A288347, A288416, which are additive rather than multiplicative.

Programs

  • Maple
    f:= proc(n)
    local PX, i, pt, j;
    for i from 0 to n do PX[i]:= binomial(n,i)/2^n od:
    pt:= 0:
    for j from 0 while pt^2 < 1/2 do pt:= pt + PX[j] od:
    j:= j-1:
    pt:= (pt-PX[j])^2:
    for i from 0 do
      pt:= pt + 2*PX[j]*PX[i];
      if pt = 1/2 then error("Probability 1/2 for i=%1 j=%2",i,j) fi;
      if pt > 1/2 then return(2^i + 2^j) fi
    od:
    end proc:
    map(f, [$1..60]); # Robert Israel, Jun 21 2017
  • Mathematica
    TwoToThe[x_] := 2^x;
    WeightsMatrix[n_] := Table[Binomial[n, i] Binomial[n, j], {i, 0, n}, {j, 0, n}]/2^(2 n);
    ValuesMatrix[n_, f_] := Table[f[i] + f[j], {i, 0, n}, {j, 0, n}];
    Distribution[n_, f_] := EmpiricalDistribution[Flatten[WeightsMatrix[n]] -> Flatten[ValuesMatrix[n, f]]];
    NewMedian[n_, f_] := Mean[Quantile[Distribution[n, f], {1/2, 1/2 + 1/2^(2 n)}]];
    Table[NewMedian[n, TwoToThe], {n, 42}]