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.

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

A316905 a(n) is the index of the first occurrence of n in A316774.

Original entry on oeis.org

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

Views

Author

Alois P. Heinz, Jul 18 2018

Keywords

Examples

			a(4) = 4 because A316774(j) = 4 for j in {4,7,12,13,36,49,55} with minimal element 4.
		

Crossrefs

Cf. A316774, A316973, A316984, A330440 (a sorted version of this), A330447, A330448.

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:
    a:= proc() local t, a; t, a:= -1, proc() -1 end;
          proc(n) local h;
            while a(n) = -1 do
              t:= t+1; h:= g(t);
              if a(h) = -1 then a(h):= t fi
            od; a(n)
          end
        end():
    seq(a(n), n=0..100);
  • Mathematica
    b[_] = 0;
    g[n_] := g[n] = Module[{t}, t = If[n < 2, n, b[g[n - 1]] + b[g[n - 2]]];       b[t] = b[t] + 1; t];
    a[n_] := Module[{t = -1, a}, a[_] = -1; Module[{h}, While[a[n] == -1, t = t + 1; h = g[t]; If[a[h] == -1, a[h] = t]]; a[n]]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Aug 28 2023, after Alois P. Heinz *)

Formula

a(n) = min { j >= 0 : A316774(j) = n }.

A316984 a(n) is the index of the last occurrence of n in A316774.

Original entry on oeis.org

0, 1, 6, 16, 55, 488, 314, 367, 279, 562, 519, 799, 500, 694, 792, 876, 1322, 1598, 5826, 1814, 6102, 5345, 2042, 5105, 2949, 3288, 5260, 4971, 6353, 5172, 8596, 3193, 6528, 8065, 8194, 6538, 6881, 6966, 7963, 5993, 8114, 9090, 8457, 8948, 12703, 9994, 6568
Offset: 0

Views

Author

Alois P. Heinz, Jul 18 2018

Keywords

Comments

[It may be that these values are only conjectural. If so, the b-file should be changed to an a-file and marked as conjectured. - N. J. A. Sloane, Dec 14 2019]

Examples

			a(4) = 55 because A316774(j) = 4 for j in {4,7,12,13,36,49,55} with maximal element 55.
		

Crossrefs

Formula

a(n) = max { j >= 0 : A316774(j) = n }.

A337063 a(n) = 1 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

1, 1, 4, 2, 1, 3, 3, 4, 4, 9, 3, 3, 16, 4, 4, 25, 5, 1, 4, 24, 6, 1, 5, 10, 2, 2, 9, 6, 4, 14, 7, 1, 6, 18, 3, 5, 15, 3, 6, 24, 8, 2, 4, 32, 8, 2, 10, 10, 9, 9, 16, 8, 6, 15, 10, 8, 16, 12, 3, 7, 14, 4, 18, 18, 9, 15, 15, 16, 16, 25, 10, 10, 36, 6, 6, 49, 7, 3
Offset: 0

Views

Author

Alex Lauber, Aug 13 2020

Keywords

Comments

Does this sequence contain every number?
Does each number appear only a finite number of times?
Starting with a(0)=0 and a(1)=1 gives the same sequence offset by one place.

Examples

			a(2) = occurrences of a(1)=1 in [a(0), a(1)]=[1, 1] * occurrences of a(0)=1 in [a(0), a(1)]=[1, 1] = 2*2 = 4.
a(3) = occurrences of a(2)=4 in [a(0), a(1), a(2)]=[1, 1, 4] * occurrences of a(1)=1 in [a(0), a(1), a(2)]=[1, 1, 4] = 1*2 = 2.
		

Crossrefs

Cf. A337064 (index of first occurrence of n).
Cf. A316774 (which adds the two previous terms), A316973.

Programs

  • PARI
    See Links section.

Extensions

More terms from Rémy Sigrist, Sep 18 2020

A337064 a(n) is the index of the first occurrence of n in A337063, or -1 if n never appears.

Original entry on oeis.org

0, 3, 5, 2, 16, 20, 30, 40, 9, 23, 90, 57, 110, 29, 36, 12, 220, 33, 342, 230, 163, 179, 494, 19, 15, 109, 128, 88, 694, 82, 744, 43, 125, 219, 169, 72, 1060, 373, 253, 85, 1205, 113, 1346, 151, 207, 564, 1726, 131, 75, 332
Offset: 1

Views

Author

Alex Lauber, Aug 13 2020

Keywords

Comments

419 is the lowest number that does not appear in the first 100000 terms of A337063.

Examples

			A337063 starts {1, 1, 4, 2, ...} so a(2) = 3.
		

Crossrefs

Cf. A337063, A316774 (adds the two previous terms), A316973 (similar index for the addition sequence).

Programs

  • PARI
    See Links section.
Showing 1-5 of 5 results.