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.

Showing 1-10 of 10 results.

A054431 Array read by antidiagonals: T(x, y) tells whether (x, y) are coprime (1) or not (0).

Original entry on oeis.org

1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1
Offset: 1

Views

Author

Keywords

Comments

Array is read along (x, y) = (1, 1), (1, 2), (2, 1), (1, 3), (2, 2), (3, 1), ...
There are nontrivial infinite paths of 1's in this sequence, moving only 1 step down or to the right at each step. Starting at (1,1), move down to (2,1), then (3,1), ..., (13,1). Then move right to (13,2), (13,3), ..., (13,11). From this point, alternate moving down to the next prime row, and right to the next prime column. - Franklin T. Adams-Watters, May 27 2014

Examples

			Rows start:
  1, 1, 1, 1, 1, 1, ...;
  1, 0, 1, 0, 1, 0, ...;
  1, 1, 0, 1, 1, 0, ...;
  1, 0, 1, 0, 1, 0, ...;
  1, 1, 1, 1, 0, 1, ...;
  1, 0, 0, 0, 1, 0, ...;
		

Crossrefs

Equal to A003989 with non-one values replaced with zeros.

Programs

  • Maple
    reduced_residue_set_0_1_array := n -> one_or_zero(igcd(((n-((trinv(n)*(trinv(n)-1))/2))+1), ((((trinv(n)-1)*(((1/2)*trinv(n))+1))-n)+1) ));
    one_or_zero := n -> `if`((1 = n),(1),(0)); # trinv given at A054425
    A054431_row := n -> seq(abs(numtheory[jacobi](n-k+1,k)),k=1..n);
    for n from 1 to 14 do A054431_row(n) od; # Peter Luschny, Aug 05 2012
  • Mathematica
    t[n_, k_] := Boole[CoprimeQ[n, k]]; Table[t[n-k+1, k], {n, 1, 14}, {k, 1, n}] // Flatten (* Jean-François Alcover, Dec 21 2012 *)
  • Sage
    def A054431_row(n): return [abs(kronecker_symbol(n-k+1,k)) for k in (1..n)]
    for n in (1..14): print(A054431_row(n)) # Peter Luschny, Aug 05 2012

Formula

T(n, k) = T(n, k-n) + T(n-k, k) starting with T(n, k)=0 if n or k are nonpositive and T(1, 1)=1. T(n, k) = A054521(n, k) if n>=k, = A054521(k, n) if n<=k. Antidiagonal sums are phi(n) = A000010(n). - Henry Bottomley, May 14 2002
As a triangular array for n>=1, 1<=k<=n, T(n,k) = |K(n-k+1|k)| where K(i|j) is the Kronecker symbol. - Peter Luschny, Aug 05 2012
Dirichlet g.f.: Sum_{n>=1} Sum_{k>=1} [gcd(n,k)=1]/n^s/k^c = zeta(s)*zeta(c)/zeta(s + c). - Mats Granvik, May 19 2021

A054424 Permutation of natural numbers: maps the canonical list of fractions (A020652/A020653) to whole Stern-Brocot (Farey) tree (top = 1/1 and both sides < 1 and > 1, but excluding the "fractions" 0/1 and 1/0).

Original entry on oeis.org

1, 2, 3, 4, 7, 8, 5, 6, 15, 16, 31, 32, 9, 11, 12, 14, 63, 64, 10, 13, 127, 128, 17, 23, 24, 30, 255, 256, 19, 28, 511, 512, 33, 18, 20, 47, 48, 27, 29, 62, 1023, 1024, 22, 25, 2047, 2048, 65, 35, 39, 21, 95, 96, 26, 56, 60, 126, 4095, 4096, 34, 40, 55, 61, 8191, 8192
Offset: 1

Views

Author

Antti Karttunen

Keywords

Examples

			Whole Stern-Brocot tree: 1/1 1/2 2/1 1/3 2/3 3/2 3/1 1/4 2/5 3/5 3/4 4/3 5/3 5/2 4/1 1/5 2/7
Canonical fractions: 1/1 1/2 2/1 1/3 3/1 1/4 2/3 3/2 4/1 1/5 5/1 1/6 2/5 3/4 4/3 5/2 6/1
		

Crossrefs

Cf. A047679, A007305, A007306, A054427, A057114. In table form: A054425. Inverse permutation: A054426.

Programs

  • Maple
    cfrac2binexp := proc(c) local i,e,n; n := 0; for i from 1 to nops(c) do e := c[i]; if(i = nops(c)) then e := e-1; fi; n := ((2^e)*n) + ((i mod 2)*((2^e)-1)); od; RETURN(n); end;
    frac2position_in_whole_SB_tree := proc(r) local k,msb; if(1 = r) then RETURN(1); else if(r > 1) then k := cfrac2binexp(convert(r,confrac)); else k := ReflectBinTreePermutation(cfrac2binexp(convert(1/r,confrac))); fi; msb := floor_log_2(k); if(r > 1) then RETURN(k + (2^(msb+1))); else RETURN(k + (2^(msb+1)) - (2^msb)); fi; fi; end;
    canonical_fractions_to_whole_SternBrocot_permutation := proc(u) local a,n,i; a := []; for n from 2 to u do for i from 1 to n-1 do if (1 = igcd(n,i)) then a := [op(a),frac2position_in_whole_SB_tree(i/(n-i))]; fi; od; od; RETURN(a); end; # ReflectBinTreePermutation and floor_log_2 given in A054429

Formula

canonical_fractions_to_whole_SternBrocot_permutation(30);

A064645 Table where the entry (n,k) (n >= 0, k >= 0) gives number of Motzkin paths of the length n with the minimum peak width of k.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 4, 1, 1, 1, 9, 2, 1, 1, 1, 21, 4, 1, 1, 1, 1, 51, 8, 2, 1, 1, 1, 1, 127, 17, 4, 1, 1, 1, 1, 1, 323, 37, 8, 2, 1, 1, 1, 1, 1, 835, 82, 16, 4, 1, 1, 1, 1, 1, 1, 2188, 185, 33, 8, 2, 1, 1, 1, 1, 1, 1, 5798, 423, 69, 16, 4, 1, 1, 1, 1, 1, 1, 1, 15511, 978, 146, 32, 8, 2, 1, 1, 1, 1, 1, 1, 1, 41835, 2283, 312, 65, 16, 4, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 0

Views

Author

Antti Karttunen, Oct 03 2001

Keywords

Examples

			E.g., we have the following nine Motzkin paths of length 4, of which the last 4 have each peak at least of width 1 and the last 2 with each peak at least 2 dashes wide, so M(4,0) = 9, M(4,1) = 4 and M(4,2) = 2.
   /\                                 _       _     __
  /  \   /\/\   __/\   _/\_   /\__   / \_   _/ \   /  \   ____
The array starts:
      1    1   1   1   1   1   1   1   1   1   1
      1    1   1   1   1   1   1   1   1   1   1
      2    1   1   1   1   1   1   1   1   1   1
      4    2   1   1   1   1   1   1   1   1   1
      9    4   2   1   1   1   1   1   1   1   1
     21    8   4   2   1   1   1   1   1   1   1
     51   17   8   4   2   1   1   1   1   1   1
    127   37  16   8   4   2   1   1   1   1   1
    323   82  33  16   8   4   2   1   1   1   1
    835  185  69  32  16   8   4   2   1   1   1
   2188  423 146  65  32  16   8   4   2   1   1
   5798  978 312 133  64  32  16   8   4   2   1
  15511 2283 673 274 129  64  32  16   8   4   2
		

Crossrefs

Column k=0: Motzkin numbers (A001006), column k=1: A004148, column k=2: A004149, column k=3: A023421, column k=4: A023422, column k=5: A023423. Uses the table A001263(n, k).

Programs

  • Maple
    # trinv() given in A054425
    [seq(A064645(j),j=0..104)]; A064645 := (n) -> Mpw((((trinv(n)-1)*(((1/2)*trinv(n))+1))-n), (n-((trinv(n)*(trinv(n)-1))/2)));
    C := (n,k) -> `if`((n <= 0),0,binomial(n,k));
    Mpw := proc(n,m) local i,k; 1+add(add(A001263(i,k)*C(n-(m*k),2*i),k=1..i),i=0..floor(n/2)); end;
  • Mathematica
    trinv[n_] := Floor[(1 + Sqrt[8 n + 1])/2];
    CC[n_, k_] := If[n <= 0, 0, Binomial[n, k]];
    a[n_] := Mpw[(((trinv[n] - 1)*(((1/2) trinv[n]) + 1)) - n), (n - ((trinv[n] (trinv[n] - 1))/2))];
    Mpw[n_, m_] := 1 + Sum[Sum[If[k == 0, 0, Binomial[i - 1, k - 1] Binomial[i, k - 1]/k] CC[n - m*k, 2i], {k, 1, i}], {i, 0, n/2}];
    Table[a[n], {n, 0, 104}] (* Jean-François Alcover, Mar 06 2016, adapted from Maple *)

A061857 Triangle in which the k-th item in the n-th row (both starting from 1) is the number of ways in which we can add 2 distinct integers from 1 to n in such a way that the sum is divisible by k.

Original entry on oeis.org

0, 1, 0, 3, 1, 1, 6, 2, 2, 1, 10, 4, 4, 2, 2, 15, 6, 5, 3, 3, 2, 21, 9, 7, 5, 4, 3, 3, 28, 12, 10, 6, 6, 4, 4, 3, 36, 16, 12, 8, 8, 5, 5, 4, 4, 45, 20, 15, 10, 9, 7, 6, 5, 5, 4, 55, 25, 19, 13, 11, 9, 8, 6, 6, 5, 5, 66, 30, 22, 15, 13, 10, 10, 7, 7, 6, 6, 5, 78, 36, 26, 18, 16, 12, 12, 9, 8, 7, 7
Offset: 1

Views

Author

Antti Karttunen, May 11 2001

Keywords

Comments

Since the sum of two distinct integers from 1 to n can be as much as 2n-1, this triangular table cannot show all the possible cases. For larger triangles showing all solutions, see A220691 and A220693. - Antti Karttunen, Feb 18 2013 [based on Robert Israel's mail, May 07 2012]

Examples

			The second term on the sixth row is 6 because we have 6 solutions: {1+3, 1+5, 2+4, 2+6, 3+5, 4+6} and the third term on the same row is 5 because we have solutions {1+2,1+5,2+4,3+6,4+5}.
Triangle begins:
   0;
   1,  0;
   3,  1,  1;
   6,  2,  2,  1;
  10,  4,  4,  2,  2;
  15,  6,  5,  3,  3,  2;
  21,  9,  7,  5,  4,  3,  3;
  28, 12, 10,  6,  6,  4,  4,  3;
  36, 16, 12,  8,  8,  5,  5,  4,  4;
  45, 20, 15, 10,  9,  7,  6,  5,  5,  4;
		

Crossrefs

This is the lower triangular region of square array A220691. See A220693 for all nonzero solutions.
The left edge (first diagonal) of the triangle: A000217, the second diagonal is given by C(((n+(n mod 2))/2), 2)+C(((n-(n mod 2))/2), 2) = A002620, the third diagonal by A058212, the fourth by A001971, the central column by A042963? trinv is given at A054425. Cf. A061865.

Programs

  • Haskell
    a061857 n k = length [()| i <- [2..n], j <- [1..i-1], mod (i + j) k == 0]
    a061857_row n = map (a061857 n) [1..n]
    a061857_tabl = map a061857_row [1..]
    -- Reinhard Zumkeller, May 08 2012
    
  • Maple
    [seq(DivSumChoose2Triangle(j),j=1..120)]; DivSumChoose2Triangle := (n) -> nops(DivSumChoose2(trinv(n-1),(n-((trinv(n-1)*(trinv(n-1)-1))/2))));
    DivSumChoose2 := proc(n,k) local a,i,j; a := []; for i from 1 to (n-1) do for j from (i+1) to n do if(0 = ((i+j) mod k)) then a := [op(a),[i,j]]; fi; od; od; RETURN(a); end;
  • Mathematica
    a[n_, 1] := n*(n-1)/2; a[n_, k_] := Module[{r}, r = Reduce[1 <= i < j <= n && Mod[i + j, k] == 0, {i, j}, Integers]; Which[Head[r] === Or, Length[r], Head[r] === And, 1, r === False, 0, True, Print[r, " not parsed"]]]; Table[a[n, k], {n, 1, 13}, {k, 1, n}] // Flatten (* Jean-François Alcover, Mar 04 2014 *)
  • Scheme
    (define (A061857 n) (A220691bi (A002024 n) (A002260 n))) ;; Antti Karttunen, Feb 18 2013. Needs A220691bi from A220691.

Formula

From Robert Israel, May 08 2012: (Start)
Let n+1 = b mod k with 0 <= b < k, q = (n+1-b)/k. Let k = c mod 2, c = 0 or 1.
If b = 0 or 1 then a(n,k) = q^2*k/2 + q*b - 2*q - b + 1 + c*q/2.
If b >= (k+3)/2 then a(n,k) = q^2*k/2 + q*b - 2*q + b - 1 - k/2 + c*(q+1)/2.
Otherwise a(n,k) = q^2*k/2 + q*b - 2*q + c*q/2. (End)

Extensions

Offset corrected by Reinhard Zumkeller, May 08 2012

A065167 Table T(n,k) read by antidiagonals, where the k-th row gives the permutation t->t+k of Z, folded to N (k >= 0, n >= 1).

Original entry on oeis.org

1, 2, 2, 3, 4, 4, 4, 1, 6, 6, 5, 6, 2, 8, 8, 6, 3, 8, 4, 10, 10, 7, 8, 1, 10, 6, 12, 12, 8, 5, 10, 2, 12, 8, 14, 14, 9, 10, 3, 12, 4, 14, 10, 16, 16, 10, 7, 12, 1, 14, 6, 16, 12, 18, 18, 11, 12, 5, 14, 2, 16, 8, 18, 14, 20, 20, 12, 9, 14, 3, 16, 4, 18, 10, 20, 16, 22, 22, 13, 14, 7, 16, 1
Offset: 0

Views

Author

Antti Karttunen, Oct 19 2001

Keywords

Comments

Simple periodic site swap permutations of natural numbers.
Row n of the table (starting from n=0) gives a permutation of natural numbers corresponding to the simple, infinite, periodic site swap pattern ...nnnnn...

Examples

			Table begins:
1 2 3 4 5 6 7 ...
2 4 1 6 3 8 5 ...
4 6 2 8 1 10 3 ...
6 8 4 10 2 12 1 ...
		

Crossrefs

Successive rows and associated site swap sequences, starting from the zeroth row: (A000027, A000004), (A065164, A000012), (A065165, A007395), (A065166, A010701). Cf. also A065171, A065174, A065177. trinv given at A054425.

Programs

  • Maple
    PerSS_table := (n) -> PerSS((((trinv(n)-1)*(((1/2)*trinv(n))+1))-n)+1, (n-((trinv(n)*(trinv(n)-1))/2))); PerSS := (n,c) -> Z2N(N2Z(n)+c);
    N2Z := n -> ((-1)^n)*floor(n/2); Z2N := z -> 2*abs(z)+`if`((z < 1),1,0);
    [seq(PerSS_table(j),j=0..119)];

Formula

Let f: Z -> N be given by f(z) = 2z if z>0 else 2|z|+1, with inverse g(z) = z/2 if z even else (1-z)/2. Then the n-th term of the k-th row is f(g(n)+k).

A065177 Table M(n,b) (columns: n >= 1, rows: b >= 0) gives the number of site swap juggling patterns with exact period n, using exactly b balls, where cyclic shifts are not counted as distinct.

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 2, 2, 1, 0, 3, 6, 3, 1, 0, 6, 15, 12, 4, 1, 0, 9, 42, 42, 20, 5, 1, 0, 18, 107, 156, 90, 30, 6, 1, 0, 30, 294, 554, 420, 165, 42, 7, 1, 0, 56, 780, 2028, 1910, 930, 273, 56, 8, 1, 0, 99, 2128, 7350, 8820, 5155, 1806, 420, 72, 9, 1, 0, 186, 5781, 26936
Offset: 0

Views

Author

Antti Karttunen, Oct 19 2001

Keywords

Examples

			Upper left corner starts as:
  1, 0,  0,   0,    0,     0,     0, ...
  1, 1,  2,   3,    6,     9,    18, ...
  1, 2,  6,  15,   42,   107,   294, ...
  1, 3, 12,  42,  156,   554,  2028, ...
  1, 4, 20,  90,  420,  1910,  8820, ...
  1, 5, 30, 165,  930,  5155, 28830, ...
  1, 6, 42, 273, 1806, 11809, 77658, ...
  ...
		

Crossrefs

Row 1: A059966, row 2: A065178, row 3: A065179, row 4: A065180.
Column 1: A002378, column 2: A059270.
Main diagonal gives A306173.
Cf. also A065167. trinv given at A054425.

Programs

  • Maple
    [seq(DistSS_table(j),j=0..119)]; DistSS_table := (n) -> DistSS((((trinv(n)-1)*(((1/2)*trinv(n))+1))-n)+1, (n-((trinv(n)*(trinv(n)-1))/2)));
    with(numtheory); DistSS := proc(n,b) local d,s; s := 0; for d in divisors(n) do s := s+mobius(n/d)*((b+1)^d - b^d); od; RETURN(s/n); end;
  • Mathematica
    trinv[n_] := Floor[(1 + Sqrt[8 n + 1])/2];
    DistSS[n_, b_] := DivisorSum[n, MoebiusMu[n/#]*((b + 1)^# - b^#)&] /n;
    a[n_] := DistSS[(((trinv[n] - 1)*(((1/2)*trinv[n]) + 1)) - n) + 1, (n - ((trinv[n]*(trinv[n] - 1))/2))];
    Table[a[n], {n, 0, 119}] (* Jean-François Alcover, Mar 06 2016, adapted from Maple *)

Formula

Row n is the inverse Euler transform of j-> n^(j-1). - Alois P. Heinz, Jun 23 2018

A062103 Number of paths by which an unpromoted knight (keima) of Shogi can move to various squares on infinite board, if it starts from its origin square, the second leftmost square of the back rank.

Original entry on oeis.org

0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 14
Offset: 1

Views

Author

Antti Karttunen, May 30 2001

Keywords

Comments

Table formatted as a square array shows the top-left corner of the infinite board. This is an aerated and sligthly skewed variant of Catalan's triangle A009766.

Crossrefs

A009766, A049604, A062104, trinv given at A054425.

Programs

  • Maple
    [seq(ShoogiKnightSeq(j),j=1..120)]; ShoogiKnightSeq := n -> ShoogiKnightTriangle(trinv(n-1)-1,(n-((trinv(n-1)*(trinv(n-1)-1))/2))-1);
    ShoogiKnightTriangle := proc(r,m) option remember; if(m < 0) then RETURN(0); fi; if(r < 0) then RETURN(0); fi; if(m > r) then RETURN(0); fi; if((1 = r) and (0 = m)) then RETURN(1); fi; RETURN(ShoogiKnightTriangle(r-3,m-2) + ShoogiKnightTriangle(r-1,m-2)); end;
  • Mathematica
    trinv[n_] := Floor[(1 + Sqrt[8 n + 1])/2];
    ShoogiKnightSeq[n_] := ShoogiKnightTriangle[trinv[n - 1] - 1, (n - ((trinv[n - 1]*(trinv[n - 1] - 1))/2)) - 1];
    ShoogiKnightTriangle[r_, m_] := ShoogiKnightTriangle[r, m] = Which[m < 0, 0, r < 0, 0, m > r, 0, r == 1 && m == 0, 1, True, ShoogiKnightTriangle[r - 3, m - 2] + ShoogiKnightTriangle[r - 1, m - 2]];
    Array[ShoogiKnightSeq, 120] (* Jean-François Alcover, Mar 06 2016, adapted from Maple *)

A062104 Square array read by antidiagonals: number of ways a black pawn (starting at any square on the second rank) can (theoretically) end at various squares on an infinite chessboard.

Original entry on oeis.org

0, 0, 1, 0, 1, 2, 0, 1, 3, 6, 0, 1, 3, 9, 15, 0, 1, 3, 10, 25, 40, 0, 1, 3, 10, 29, 69, 109, 0, 1, 3, 10, 30, 84, 193, 302, 0, 1, 3, 10, 30, 89, 242, 544, 846, 0, 1, 3, 10, 30, 90, 263, 698, 1544, 2390, 0, 1, 3, 10, 30, 90, 269, 774, 2016, 4406, 6796, 0, 1, 3, 10, 30, 90, 270
Offset: 0

Views

Author

Antti Karttunen, May 30 2001

Keywords

Comments

Table formatted as a square array shows the top-left corner of the infinite board.

Examples

			Array begins:
0       0       0       0       0       0       0       0       0       0       0       0 ...
1       1       1       1       1       1       1       1       1       1       1 ...
2       3       3       3       3       3       3       3       3       3 ...
6       9       10      10      10      10      10      10      10 ...
15      25      29      30      30      30      30      30 ...
40      69      84      89      90      90      90 ...
109     193     242     263     269     270 ...
302     544     698     774 ...
846     1544    2016 ...
2390    4406 ...
6796 ...
		

Crossrefs

A062106 gives the left column and A062107 the diagonal of the table. A062105 is a more regular variant. Cf. also A062103. Trinv given at A054425.

Programs

  • Maple
    [seq(CPTSeq(j),j=0..91)]; CPTSeq := n -> ChessPawnTriangle( (1+(n-((trinv(n)*(trinv(n)-1))/2))), ((((trinv(n)-1)*(((1/2)*trinv(n))+1))-n)+1) );
    ChessPawnTriangle := proc(r,c) option remember; if(r < 2) then RETURN(0); fi; if(c < 1) then RETURN(0); fi; if(2 = r) then RETURN(1); fi; if(4 = r) then RETURN(1+ChessPawnTriangle(r-1,c-1)+ChessPawnTriangle(r-1,c)+ChessPawnTriangle(r-1,c+1));
    else RETURN(ChessPawnTriangle(r-1,c-1)+ChessPawnTriangle(r-1,c)+ChessPawnTriangle(r-1,c+1)); fi; end;
  • Mathematica
    trinv[n_] := Floor[(1 + Sqrt[8 n + 1])/2];
    CPTSeq[n_] := ChessPawnTriangle[(1 + (n - ((trinv[n]*(trinv[n] - 1))/2))), ((((trinv[n] - 1)*(((1/2)*trinv[n]) + 1)) - n) + 1)];
    ChessPawnTriangle[r_, c_] := ChessPawnTriangle[r, c] = Which[r < 2, 0, c < 1, 0, 2 == r, 1, 4 == r, 1 + ChessPawnTriangle[r - 1, c - 1] + ChessPawnTriangle[r - 1, c] + ChessPawnTriangle[r - 1, c + 1], True, ChessPawnTriangle[r - 1, c - 1] + ChessPawnTriangle[r - 1, c] + ChessPawnTriangle[r - 1, c + 1]];
    Table[CPTSeq[j], {j, 0, 91}] (* Jean-François Alcover, Mar 06 2016, adapted from Maple *)

Extensions

Edited by N. J. A. Sloane, May 22 2014

A338579 Triangle T(D,N) read by rows, 1 <= N < D >= 2, where T(D,N) is the position of the fraction N/D in the Farey tree (or Stern-Brocot subtree) A007305/A007306.

Original entry on oeis.org

2, 3, 4, 5, 2, 8, 9, 6, 7, 16, 17, 3, 2, 4, 32, 33, 10, 12, 13, 15, 64, 65, 5, 11, 2, 14, 8, 128, 129, 18, 3, 24, 25, 4, 31, 256, 257, 9, 20, 6, 2, 7, 29, 16, 512, 513, 34, 19, 21, 48, 49, 28, 30, 63, 1024, 1025, 17, 5, 3, 23, 2, 26, 4, 8, 32, 2048
Offset: 2

Views

Author

Hugo Pfoertner, Nov 10 2020

Keywords

Comments

Fractions are reduced to lowest terms.

Examples

			The triangle begins
     N     1   2  3  4  5  6   7   8   9   10   11   12   13    14    15
   D \------------------------------------------------------------------
   2 |     2   .  .  .  .  .   .   .   .    .    .    .    .     .     .
   3 |     3   4  .  .  .  .   .   .   .    .    .    .    .     .     .
   4 |     5   2  8  .  .  .   .   .   .    .    .    .    .     .     .
   5 |     9   6  7 16  .  .   .   .   .    .    .    .    .     .     .
   6 |    17   3  2  4 32  .   .   .   .    .    .    .    .     .     .
   7 |    33  10 12 13 15 64   .   .   .    .    .    .    .     .     .
   8 |    65   5 11  2 14  8 128   .   .    .    .    .    .     .     .
   9 |   129  18  3 24 25  4  31 256   .    .    .    .    .     .     .
  10 |   257   9 20  6  2  7  29  16 512    .    .    .    .     .     .
  11 |   513  34 19 21 48 49  28  30  63 1024    .    .    .     .     .
  12 |  1025  17  5  3 23  2  26   4   8   32 2048    .    .     .     .
  13 |  2049  66 36 40 22 96  97  27  57   61  127 4096    .     .     .
  14 |  4097  33 35 10 41 12   2  13  56   15   62   64 8192     .     .
  15 |  8193 130  9 37  3  6 192 193   7    4   60   16  255 16384     .
  16 | 16385  65 68  5 80 11  47   2  50   14  113    8  125   128 32768
.
T(7,2) = 10 because A007306(10) = 7 and A007305(10) = 2 is the required double match, i.e., the position of the fraction 2/7 in the Farey tree is 10.
T(14,4) = T(7,2) = 10, because the fraction 4/14 reduced to lowest terms is 2/7.
T(16,12) = 8, because the fraction 12/16 reduced to lowest terms is 3/4, with the double match A007306(8)=4 and A007305(8)=3.
		

Crossrefs

Programs

  • PARI
    \\ using Yosu Yurramendi's formulas
    a338579(lim)={
    my(a7305=vectorsmall(2+2^(lim+2)),a7306=vectorsmall(2+2^(lim+2)));
      a7305[1]=1;
      for(m=1,lim,
         for(k=0,2^(m-1)-1,
          a7305[2^m+k]=a7305[2^(m-1)+k];
          a7305[2^m+2^(m-1)+k]=a7305[2^(m-1)+k]+a7305[2^m-k-1]
         )
      );
      a7306[1]=1;a7306[2]=2;
      for(m=0,lim,
         for(k=1,2^m,
          a7306[2^(m+1)+k]=a7306[2^m+k] + a7306[k];
          a7306[2^(m+1)-k+1]=a7306[2^m+k]
         )
      );
       my(findinFS(x)=for(k=2,#a7306,
          if(!(a7305[k-1]/a7306[k]-x),return(k)));0);
      for(de=2,lim+2,for(nu=1,de-1,my(q=nu/de);print1(findinFS(q),", ")))
    };
    a338579(10);
    
  • PARI
    T(d,n) = my(ret=1); d-=n; while(n!=d, ret<<=1; if(n>d, n-=d;ret++, d-=n)); ret+1; \\ Kevin Ryde, Nov 11 2020

A061859 Differences between the ordinary multiplication table A004247 and Xmult table A048720, computed for {3..n} * {3..n}.

Original entry on oeis.org

4, 0, 0, 0, 0, 0, 8, 0, 0, 8, 12, 0, 8, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 8, 16, 8, 0, 0, 0, 0, 0, 24, 24, 0, 0, 0, 4, 0, 0, 0, 28, 0, 0, 0, 4, 16, 0, 16, 0, 0, 0, 0, 16, 0, 16, 16, 0, 16, 0, 0, 0, 0, 0, 16, 0, 16, 24, 0, 0, 8, 16, 0, 0, 16, 8, 0, 0, 24, 28, 0, 8, 32, 28, 0, 16, 0, 28, 32, 8, 0, 28
Offset: 0

Views

Author

Antti Karttunen, May 11 2001

Keywords

Crossrefs

Cf. "Zoomed out" variant: A061858, trinv given at A054425. The first, third and fifth diagonals are given by A048728-A048730.

Programs

  • Maple
    [seq(diff_mult_Xmult_table3(j),j=0..119)]; diff_mult_Xmult_table3 := (n) -> (mult_table3(n) - Xmult_table3(n));
    mult_table3 := (n) -> floor(evalf(((((trinv(n)-1)*(((1/2)*trinv(n))+1))-n)+3) * (3+(n-((trinv(n)*(trinv(n)-1))/2))) ));
    Xmult_table3 := (n) -> Xmult( ((((trinv(n)-1)*(((1/2)*trinv(n))+1))-n)+3),(3+(n-((trinv(n)*(trinv(n)-1))/2))) );
Showing 1-10 of 10 results.