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

A330587 A(n,k) is the n-th index m such that A330439(m) = k; square array A(n,k), n>=1, k>=1, read by antidiagonals.

Original entry on oeis.org

0, 3, 1, 6, 7, 2, 13, 10, 9, 4, 21, 16, 12, 15, 5, 23, 31, 19, 18, 17, 8, 27, 38, 36, 29, 25, 20, 11, 33, 41, 49, 44, 30, 26, 24, 14, 46, 43, 55, 56, 59, 40, 37, 34, 22, 67, 52, 64, 58, 62, 61, 50, 39, 35, 28, 81, 70, 78, 76, 73, 72, 69, 51, 47, 53, 32, 104, 94, 91, 88, 84, 75, 79, 82, 66, 57, 54, 42
Offset: 1

Views

Author

Alois P. Heinz, Dec 18 2019

Keywords

Examples

			Square array A(n,k) begins:
   0,  3,  6, 13,  21,  23,  27,  33,  46,  67, ...
   1,  7, 10, 16,  31,  38,  41,  43,  52,  70, ...
   2,  9, 12, 19,  36,  49,  55,  64,  78,  91, ...
   4, 15, 18, 29,  44,  56,  58,  76,  88,  93, ...
   5, 17, 25, 30,  59,  62,  73,  84,  90,  98, ...
   8, 20, 26, 40,  61,  72,  75,  87, 117, 139, ...
  11, 24, 37, 50,  69,  79,  85, 121, 124, 154, ...
  14, 34, 39, 51,  82, 102, 118, 142, 155, 157, ...
  22, 35, 47, 66,  97, 110, 133, 180, 190, 202, ...
  28, 53, 57, 74, 106, 116, 164, 183, 197, 205, ...
		

Crossrefs

Column k=1 gives A330440.
Row n=1 gives A330588.
Main diagonal gives A330589.

Programs

  • Maple
    b:= proc() 0 end:
    g:= proc(n) option remember; local t;
          t:= `if`(n<2, n, b(g(n-1))+b(g(n-2)));
          b(t):= b(t)+1; t
        end:
    f:= proc(n) option remember; b(g(n)) end:
    A:= proc() local l, t; t, l:= -1, proc() [] end;
          proc(n,k) local h;
            while nops(l(k))
    				
  • Mathematica
    b[_] = 0;
    g[n_] := g[n] = Module[{t}, t = If[n < 2, n, b[g[n - 1]] + b[g[n - 2]]]; b[t]++; t];
    f[n_] := f[n] = b[g[n]];
    A[n_, k_] := Module[{l, t = -1, h}, l[_] = {}; While[Length[l[k]] < n, t++; h = f[t]; AppendTo[l[h], t]]; l[k][[n]]];
    Table[Table[A[n, 1 + d - n], {n, 1, d}], {d, 1, 14}] // Flatten (* Jean-François Alcover, Feb 11 2021, after Alois P. Heinz *)

A330588 a(n) is the first index m such that A330439(m) = n.

Original entry on oeis.org

0, 3, 6, 13, 21, 23, 27, 33, 46, 67, 81, 104, 107, 114, 129, 166, 169, 172, 193, 261, 267, 276, 287, 311, 373, 430, 457, 478, 485, 590, 596, 656, 691, 768, 789, 796, 873, 941, 969, 1047, 1093, 1149, 1170, 1239, 1303, 1349, 1491, 1533, 1555, 1567, 1805, 1808
Offset: 1

Views

Author

Alois P. Heinz, Dec 18 2019

Keywords

Crossrefs

Row n=1 of A330587.

Programs

  • Maple
    b:= proc() 0 end:
    g:= proc(n) option remember; local t;
          t:= `if`(n<2, n, b(g(n-1))+b(g(n-2)));
          b(t):= b(t)+1; t
        end:
    f:= proc(n) option remember; b(g(n)) end:
    a:= proc() local l, t; t, l:= -1, proc() -1 end;
          proc(k) local h;
            while l(k)<0 do t:= t+1; h:= f(t);
              if l(h)<0 then l(h):= t fi
            od: l(k)
          end
        end():
    seq(a(n), n=1..60);
  • Mathematica
    b[_] = 0;
    g[n_] := g[n] = Module[{t}, t = If[n < 2, n, b[g[n-1]] + b[g[n-2]]]; b[t]++; t];
    f[n_] := f[n] = b[g[n]];
    A[n_, k_] := Module[{l, t = -1, h}, l[_] = {}; While[Length[l[k]] < n, t++; h = f[t]; AppendTo[l[h], t]]; l[k][[n]]];
    a[k_] := A[1, k];
    Table[a[n], {n, 1, 60}] (* Jean-François Alcover, Dec 13 2023, after Alois P. Heinz *)

A330589 The n-th index m such that A330439(m) = n.

Original entry on oeis.org

0, 7, 12, 29, 59, 72, 85, 142, 190, 205, 238, 270, 305, 318, 402, 492, 619, 652, 795, 845, 950, 996, 1121, 1163, 1228, 1393, 1548, 1662, 1756, 1920, 1937, 2106, 2202, 2351, 2448, 2555, 2594, 2707, 2788, 3254, 3420, 3466, 3663, 3974, 4136, 4282, 4363, 4621, 4732
Offset: 1

Views

Author

Alois P. Heinz, Dec 18 2019

Keywords

Crossrefs

Main diagonal of A330587.

Programs

  • Maple
    b:= proc() 0 end:
    g:= proc(n) option remember; local t;
          t:= `if`(n<2, n, b(g(n-1))+b(g(n-2)));
          b(t):= b(t)+1; t
        end:
    f:= proc(n) option remember; b(g(n)) end:
    a:= proc() local a, b, t; a, b, t:= proc() end, proc() 0 end, -1;
          proc(k) local h;
            while b(k)
    				

Formula

a(n) = A330587(n,n).

A316774 a(n) = n for n < 2, a(n) = freq(a(n-1),n) + freq(a(n-2),n) for n >= 2, where freq(i,j) is the number of times i appears in [a(0),a(1),...,a(j-1)].

Original entry on oeis.org

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

Views

Author

Peter Illig, Jul 12 2018

Keywords

Comments

In other words, a(n) = (number of times a(n-1) has appeared) plus (number of times a(n-2) has appeared). - N. J. A. Sloane, Dec 13 2019
What is the asymptotic behavior of this sequence?
Does it contain every positive integer at least once?
Does it contain every positive integer at most finitely many times?
Additional comments from Peter Illig's "Puzzles" link below (Start):
Sometimes referred to as "The Devil's Sequence" (by me), due to the early presence of three consecutive 6's (and my inability to understand it). The next time a number occurs three times in a row isn't until a(355677).
If each n does appear only finitely many times, approximately how many times does it appear? (It seems to be close to 2n.)
What are the best possible upper/lower bounds on a(n)?
Let r(k) be the smallest n such that {0,1,2,...,k} is contained in {a(0),...,a(n)}. What is the asymptotic behavior of r(k)? (It seems to be close to k^2/2.)
(End)

Examples

			For n=4, a(n-1) = a(n-2) = 2, and 2 appears twice in the first 4 terms. So a(4) = 2 + 2 = 4.
		

Crossrefs

Cf. A001462, A316973 (freq(n)), A316905 (when n appears), A316984 (when n last appears), A330439 (total number of times a(n) has appeared so far).
For records see A330330, A330331.
See A306246 and A329934 for similar sequences with different initial conditions.
A330332 considers the frequencies of the three previous terms.

Programs

  • Maple
    b:= proc() 0 end:
    a:= proc(n) option remember; local t;
          t:= `if`(n<2, n, b(a(n-1))+b(a(n-2)));
          b(t):= b(t)+1; t
        end:
    seq(a(n), n=0..200);  # Alois P. Heinz, Jul 12 2018
  • Mathematica
    a = prev = {0, 1};
    Do[
    AppendTo[prev, Count[a, prev[[1]]] + Count[a, prev[[2]]]];
    AppendTo[a, prev[[3]]];
    prev = prev[[2 ;;]] , {78}]
    a (* Peter Illig, Jul 12 2018 *)
  • Python
    from itertools import islice
    from collections import Counter
    def agen():
        a = [0, 1]; c = Counter(a); yield from a
        while True:
            a = [a[-1], c[a[-1]] + c[a[-2]]]; c[a[-1]] += 1; yield a[-1]
    print(list(islice(agen(), 80))) # Michael S. Branicky, Oct 13 2022

Extensions

Definition clarified by N. J. A. Sloane, Dec 13 2019

A330440 Numbers k such that A316774(k) != A316774(j) for all 0 <= j < k.

Original entry on oeis.org

0, 1, 2, 4, 5, 8, 11, 14, 22, 28, 32, 42, 45, 48, 68, 71, 77, 89, 92, 95, 108, 115, 140, 149, 194, 216, 254, 257, 260, 263, 268, 277, 295, 298, 310, 340, 346, 362, 365, 424, 431, 462, 476, 479, 486, 539, 560, 576, 579, 657, 692, 707, 754, 757, 794, 797, 928
Offset: 1

Views

Author

Alois P. Heinz, Dec 14 2019

Keywords

Comments

This is a sorted version of A316905.
List of indices k such that A330439(k) = 1.

Crossrefs

Column k=1 of A330587.

Programs

  • Maple
    b:= proc() 0 end:
    g:= proc(n) option remember; local t;
          t:= `if`(n<2, n, b(g(n-1))+b(g(n-2)));
          b(t):= b(t)+1; t
        end:
    f:= proc(n) option remember; b(g(n)) end:
    a:= proc(n) option remember; local k; for k from 1+
          `if`(n=1, -1, a(n-1)) while f(k)<>1 do od; k
        end:
    seq(a(n), n=1..80);
  • Mathematica
    b[_] = 0;
    g[n_] := g[n] = Module[{t},
         t = If[n < 2, n, b[g[n - 1]] + b[g[n - 2]]];
         b[t]++; t];
    f[n_] := f[n] = b[g[n]];
    a[n_] := a[n] = Module[{k}, For[k = 1 +
         If[n == 1, -1, a[n - 1]], f[k] != 1, k++]; k];
    Table[a[n], {n, 1, 80}] (* Jean-François Alcover, Jun 01 2022, after Alois P. Heinz *)

Formula

{ k >= 0 : A330439(k) = 1 }.
Showing 1-5 of 5 results.