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-3 of 3 results.

A283962 Interspersion of the signature sequence of sqrt(1/2).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 10, 12, 13, 15, 17, 14, 16, 18, 20, 22, 25, 19, 21, 23, 26, 28, 31, 34, 24, 27, 29, 32, 35, 38, 41, 44, 30, 33, 36, 39, 42, 46, 49, 52, 56, 37, 40, 43, 47, 50, 54, 58, 61, 65, 69, 45, 48, 51, 55, 59, 63, 67, 71, 75, 79, 84, 53
Offset: 1

Views

Author

Clark Kimberling, Mar 19 2017

Keywords

Comments

Every row intersperses all other rows, and every column intersperses all other columns. The array is the dispersion of the complement of (column 1 = A022776).
R(n,m) = position of n*r + m when all the numbers k*r + h, where r = sqrt(2), k >= 1, h >= 0, are jointly ranked. - Clark Kimberling, Oct 06 2017

Examples

			Northwest corner of R:
   1   2   4   7  10  14  19  24  30
   3   5   8  12  16  21  27  33  40
   6   9  13  18  23  29  36  43  51
  11  15  20  26  32  39  47  44  64
  17  22  28  35  42  50  59  68  78
  25  31  38  46  54  63  73  83  94
		

Crossrefs

Programs

  • Mathematica
    r = Sqrt[1/2]; z = 100;
    s[0] = 1; s[n_] := s[n] = s[n - 1] + 1 + Floor[n*r];
    u = Table[n + 1 + Sum[Floor[(n - k)/r], {k, 0, n}], {n, 0, z}] (* A022775, col 1 of A283962 *)
    v = Table[s[n], {n, 0, z}] (* A022776, row 1 of A283962*)
    w[i_, j_] := u[[i]] + v[[j]] + (i - 1)*(j - 1) - 1;
    Grid[Table[w[i, j], {i, 1, 10}, {j, 1, 10}]] (* A283962, array *)
    Flatten[Table[w[k, n - k + 1], {n, 1, 20}, {k, 1, n}]] (* A283962, sequence *)
  • PARI
    r = sqrt(1/2);
    z = 100;
    s(n) = if(n<1, 1, s(n - 1) + 1 + floor(n*r));
    p(n) = n + 1 + sum(k=0, n, floor((n - k)/r));
    u = v = vector(z + 1);
    for(n=1, 101, (v[n] = s(n - 1)));
    for(n=1, 101, (u[n] = p(n - 1)));
    w(i, j) = u[i] + v[j] + (i - 1) * (j - 1) - 1;
    tabl(nn) = {for(n=1, nn, for(k=1, n, print1(w(k, n - k + 1), ", "); );print(); ); };
    tabl(10) \\ Indranil Ghosh, Mar 21 2017
    
  • Python
    r = 0.5 ** 0.5
    def s(n): return 1 if n<1 else s(n - 1) + 1 + int(n*r)
    def p(n): return n + 1 + sum([int((n - k)/r) for k in range(0, n+1)])
    v=[s(n) for n in range(0, 101)]
    u=[p(n) for n in range(0, 101)]
    def w(i,j): return u[i - 1] + v[j - 1] + (i - 1) * (j - 1) - 1
    for n in range(1, 11):
        print([w(k, n - k + 1) for k in range(1, n + 1)]) # Indranil Ghosh, Mar 21 2017
    
  • Python
    import numpy as np
    r = np.sqrt(1/2)
    x = np.arange(11)
    u = np.cumsum(np.ceil(x / r)).astype(int)
    v = np.cumsum(np.ceil(x * r)).astype(int)
    print(*[1 + u[k] + v[n-k] + k*(n-k) for n in range(11) for k in range(n+1)], sep=', ')
    # David Radcliffe, May 10 2025

Formula

R(i,j) = R(i,0) + R(0,j) + i*j - 1, for i>=1, j>=1.

A007336 Signature sequence of sqrt 2 (arrange the numbers i+j*x (i,j >= 1) in increasing order; the sequence of i's is the signature of x).

Original entry on oeis.org

1, 2, 1, 3, 2, 1, 4, 3, 2, 5, 1, 4, 3, 6, 2, 5, 1, 4, 7, 3, 6, 2, 5, 8, 1, 4, 7, 3, 6, 9, 2, 5, 8, 1, 4, 7, 10, 3, 6, 9, 2, 5, 8, 1, 11, 4, 7, 10, 3, 6, 9, 2, 12, 5, 8, 1, 11, 4, 7, 10, 3, 13, 6, 9, 2, 12, 5, 8, 1, 11, 4, 14, 7, 10, 3, 13, 6, 9, 2, 12, 5, 15, 8, 1, 11, 4, 14, 7, 10, 3, 13, 6, 16, 9, 2
Offset: 1

Views

Author

Keywords

References

  • Clark Kimberling, "Fractal Sequences and Interspersions", Ars Combinatoria, vol. 45 p 157 1997.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    Take[ Transpose[ Sort[ Flatten[ Table[{i + j*Sqrt[2], i}, {i, 17}, {j, 15}], 1], #1[[1]] < #2[[1]] &]][[2]], 96] (* Robert G. Wilson v, Jul 24 2004 *)
    Quiet[Block[{$ContextPath}, Needs["Combinatorica`"]], {General::compat}]
    memos = <||>;
    zeroBasedC[theta_, i_] := zeroBasedC[theta, i] = Module[{memo, depth},
      memo = Lookup[memos, theta, {-1, 0}];
      While[memo[[-1]] <= i, AppendTo[memo, memo[[-1]] + Ceiling[theta * (Length[memo] - 1)]]];
      memos[i] = memo;
      depth = Combinatorica`BinarySearch[memo, i] - 3/2;
      If[IntegerQ[depth] && depth <= i, 1 + zeroBasedC[theta, i - depth], 0]
    ];
    A007336[i_] := zeroBasedC[2^(1/2), i - 1] + 1;
    Table[A007336[i], {i, 1, 100}] (* Brady J. Garvin, Aug 19 2024 *)
  • Python
    from bisect import bisect
    from collections import defaultdict
    from functools import cache
    from math import ceil
    memos = defaultdict(lambda: [-1, 0])
    @cache
    def zero_based_c(theta, i):
        memo = memos[theta]
        while memo[-1] <= i:
            memo.append(memo[-1] + ceil(theta * (len(memo) - 1)))
        depth = bisect(memo, i) - 1
        return 0 if depth > i or memo[depth] == i else 1 + zero_based_c(theta, i - depth)
    def A007336(i):
        return zero_based_c(2 ** 0.5, i - 1) + 1
    print([A007336(i) for i in range(1, 1001)])  # Brady J. Garvin, Aug 18 2024

Formula

If delete first occurrence of 1, 2, 3, ... the sequence is unchanged.

Extensions

More terms from Robert G. Wilson v, Jul 24 2004

A283939 Interspersion of the signature sequence of sqrt(2).

Original entry on oeis.org

1, 3, 2, 6, 5, 4, 11, 9, 8, 7, 17, 15, 13, 12, 10, 25, 22, 20, 18, 16, 14, 34, 31, 28, 26, 23, 21, 19, 44, 41, 38, 35, 32, 29, 27, 24, 56, 52, 49, 46, 42, 39, 36, 33, 30, 69, 65, 61, 58, 54, 50, 47, 43, 40, 37, 84, 79, 75, 71, 67, 63, 59, 55, 51, 48, 45, 100
Offset: 1

Views

Author

Clark Kimberling, Mar 19 2017

Keywords

Comments

Row n is the ordered sequence of numbers k such that A007336(k)=n. As a sequence, A283939 is a permutation of the positive integers. As an array, A283939 is the joint-rank array (defined at A182801) of the numbers {i+j*r}, for i>=1, j>=1, where r = sqrt(2). This is a transposable interspersion; i.e., every row intersperses all other rows, and every column intersperses all other columns.

Examples

			Northwest corner:
  1   3   6   11   17   25   34   44   56
  2   5   9   15   22   31   41   52   65
  4   8   13  20   28   38   49   61   75
  7   12  18  26   35   46   58   71   86
  10  16  23  32   42   54   67   81   97
  14  21  29  39   50   63   77   91   109
		

Crossrefs

Programs

  • Mathematica
    r = Sqrt[2]; z = 100;
    s[0] = 1; s[n_] := s[n] = s[n - 1] + 1 + Floor[n*r];
    u = Table[n + 1 + Sum[Floor[(n - k)/r], {k, 0, n}], {n, 0, z}] (* A022776, col 1 of A283939 *)
    v = Table[s[n], {n, 0, z}] (* A022775, row 1 of A283939*)
    w[i_, j_] := u[[i]] + v[[j]] + (i - 1)*(j - 1) - 1;
    Grid[Table[w[i, j], {i, 1, 10}, {j, 1, 10}]] (* A283939, array *)
    p = Flatten[Table[w[k, n - k + 1], {n, 1, 20}, {k, 1, n}]] (* A283939, sequence *)
  • PARI
    r = sqrt(2);
    z = 100;
    s(n) = if(n<1, 1, s(n - 1) + 1 + floor(n*r));
    p(n) = n + 1 + sum(k=0, n, floor((n - k)/r));
    u = v = vector(z + 1);
    for(n=1, 101, (v[n] = s(n - 1)));
    for(n=1, 101, (u[n] = p(n - 1)));
    w(i, j) = u[i] + v[j] + (i - 1) * (j - 1) - 1;
    tabl(nn) = {for(n=1, nn, for(k=1, n, print1(w(k, n - k + 1), ", "); );print(); ); };
    tabl(10) \\ Indranil Ghosh, Mar 21 2017
    
  • Python
    sqrt2 = 2 ** 0.5
    def s(n): return 1 if n<1 else s(n - 1) + 1 + int(n*sqrt2)
    def p(n): return n + 1 + sum([int((n - k)/sqrt2) for k in range(0, n+1)])
    v=[s(n) for n in range(0, 101)]
    u=[p(n) for n in range(0, 101)]
    def w(i,j): return u[i - 1] + v[j - 1] + (i - 1) * (j - 1) - 1
    for n in range(1, 11):
        print ([w(k, n - k + 1) for k in range(1, n + 1)]) # Indranil Ghosh, Mar 21 2017
Showing 1-3 of 3 results.