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.

A293160 Number of distinct terms in row n of Stern's diatomic array, A049456.

Original entry on oeis.org

1, 1, 2, 3, 5, 7, 13, 20, 31, 48, 78, 118, 191, 300, 465, 734, 1175, 1850, 2926, 4597, 7296, 11552, 18278, 28863, 45832, 72356, 114742, 181721, 287926, 455748, 722458, 1144370, 1813975, 2873751, 4553643, 7213620, 11432169, 18120733, 28716294, 45491133
Offset: 0

Views

Author

N. J. A. Sloane, Oct 12 2017, answering a question raised by Barry Carter in an email message. Barry Carter worked out the first 26 terms

Keywords

Comments

Equivalently, a(n) is the number of distinct terms in row n of the Stern-Brocot sequence (A002487) when that sequence is divided into blocks of lengths 1, 2, 4, 8, 16, 32, ...
It would be nice to have a formula or recurrence, or even some bounds. Empirically, a(n) seems to be roughly 2^(2n/3) for the known values. Note that the first half of row n has about 2^(n-2) terms, and the maximal multiplicity is given by A293957(n), so 2^(n-2)/A293957(n) is a lower bound on a(n), which seems not too bad for the known values. - N. J. A. Sloane, Nov 04 2017
The multiset of terms in row n of Stern's diatomic array, with unique elements counted by a(n), is the same as the multiset of numerators of fractions in row n of Kepler's tree. Indeed, a fraction p/q is in row n-1 of Kepler's tree if and only if p/q and q/p are in row n of Calkin-Wilf tree. To form row n of Stern's diatomic array, one should take either numerators and denominators of fractions less than 1 or all numerators from Calkin-Wilf tree row n, in either case p/q and q/p contribute p and q. In Kepler's tree, a fraction p/q contributes p and q as numerators to the next row, i.e. row n. See A294442 for Kepler's tree and A294444 for the number of distinct denominators in it. - Andrey Zabolotskiy, Dec 05 2024

Examples

			Row 4 of A294442 contains eight fractions: 1/5, 4/5, 3/7, 4/7, 2/7, 2/7, 3/8, 5/8.
There are five distinct numerators, so a(4) = 5.
		

Crossrefs

See A135510 for the smallest positive missing number in each row.
Cf. A294442, A294444, A295783 (first differences).

Programs

  • Maple
    A049456 := proc(n, k)
        option remember;
        if n =1 then
            if k >= 0 and k <=1 then
                1;
            else
                0 ;
            end if;
        elif type(k, 'even') then
            procname(n-1, k/2) ;
        else
            procname(n-1, (k+1)/2)+procname(n-1, (k-1)/2) ;
        end if;
    end proc: # R. J. Mathar, Dec 12 2014
    # A293160. This is not especially fast, but it will easily calculate the first 26 terms and confirm Barry Carter's values.
    rho:=n->[seq(A049456(n,k),k=0..2^(n-1))];
    w:=n->nops(convert(rho(n),set));
    [seq(w(n),n=1..26)];
    # Alternative program:
    # S[n] is the list of fractions, written as pairs [i, j], in row n of Kepler's triangle; nc is the number of distinct numerators, and dc the number of distinct denominators
    S[0]:=[[1, 1]]; S[1]:=[[1, 2]];
    nc:=[1, 1]; dc:=[1, 1];
    for n from 2 to 18 do
    S[n]:=[];
    for k from 1 to nops(S[n-1]) do
    t1:=S[n-1][k];
    a:=[t1[1], t1[1]+t1[2]];
    b:=[t1[2], t1[1]+t1[2]];
    S[n]:=[op(S[n]), a, b];
    od:
    listn:={};
    for k from 1 to nops(S[n]) do listn:={op(listn), S[n][k][1]}; od:
    c:=nops(listn);  nc:=[op(nc), c];
    listd:={};
    for k from 1 to nops(S[n]) do listd:={op(listd), S[n][k][2]}; od:
    c:=nops(listd);  dc:=[op(dc), c];
    od:
    nc; # this sequence
    dc; # A294444
    # N. J. A. Sloane, Nov 20 2017
  • Mathematica
    Length[Union[#]]& /@ NestList[Riffle[#, Total /@ Partition[#, 2, 1]]&, {1, 1}, 26] (* Jean-François Alcover, Mar 25 2020, after Harvey P. Dale in A049456 *)
    Map[Length@ Union@ Numerator@ # &, #] &@ Nest[Append[#, Flatten@ Map[{#1/(#1 + #2), #2/(#1 + #2)} & @@ {Numerator@ #, Denominator@ #} &, Last@ #]] &, {{1/1}, {1/2}}, 21] (* Michael De Vlieger, Apr 18 2018 *)
  • Python
    from itertools import chain, product
    from functools import reduce
    def A293160(n): return n if n <= 1 else len({1}|set(sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if y else (x[0]+x[1],x[1]),chain(k,(1,)),(1,0))) for k in product((False,True),repeat=n-2))) # Chai Wah Wu, Jun 20 2022

Extensions

a(28)-a(39) from Don Reble, Oct 16 2017
a(0) prepended and content related to Kepler's tree added from a duplicate entry (where the terms up to a(28) have been independently obtained by Michael De Vlieger) by Andrey Zabolotskiy, Dec 06 2024

A178031 Consider the Farey tree A049455/A049456; a(n) = row at which the denominator n first appears (assumes first row is labeled row 1).

Original entry on oeis.org

1, 2, 3, 4, 4, 6, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 7, 8, 8, 8, 8, 8, 8, 9, 8, 8, 8, 9, 9, 8, 9, 9, 9, 10, 9, 9, 9, 10, 9, 9, 9, 9, 9, 10, 9, 9, 10, 10, 10, 11, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
Offset: 1

Views

Author

N. J. A. Sloane, Dec 16 2010

Keywords

Comments

Computed by Alan Wechsler, Dec 16 2010.
Richard C. Schroeppel also asked about the analogous sequence giving the last occurrence of denominator n.
The first occurrence of k in this sequence is apparently at n = A135510(k-1), except for k=5. The last occurrence of k is at n = Fibonacci(k). - Andrey Zabolotskiy, Dec 01 2024

Examples

			Start with a pair of fractions 0/1, 1/1 and repeatedly insert the "Farey sum" (p+r)/(q+s) in between every pair of adjacent fractions p/q, r/s. The first few iterations are:
1:   0/1                                     1/1
2:   0/1                 1/2                 1/1
3:   0/1       1/3       1/2       2/3       1/1
4:   0/1  1/4  1/3  2/5  1/2  3/5  2/3  3/4  1/1
We only look at the denominators in this table (which form the sequence A049456, or A002487 if the rightmost column is removed).
1 first appears in row 1, so a(1) = 1.
2 first appears in row 2, so a(2) = 2.
3 first appears in row 3, so a(3) = 3.
4 and 5 first appear in row 4, so a(4) = a(5) = 4.
		

References

  • Based on a posting by Richard C. Schroeppel to the Math Fun Mailing List, Dec 15 2010.

Crossrefs

See A178047 for another version. Cf. A002487, A006842, A006843, A177903, A178042, A135510.

Extensions

More terms from Bo Gyu Jeong, Oct 20 2012

A293957 When A002487 is written as a triangle the n-th row has length 2^(n-1); a(n) is the maximal multiplicity of any entry in that row, considering the entries strictly between the initial 1 and the central 2.

Original entry on oeis.org

0, 0, 0, 1, 1, 2, 2, 4, 5, 6, 8, 12, 16, 22, 29, 36, 48, 67, 84, 118, 151, 203, 270, 362, 472, 636, 846, 1142, 1526, 2024, 2736, 3666, 4918, 6550, 8776, 11796, 15824
Offset: 0

Views

Author

N. J. A. Sloane, Nov 03 2017

Keywords

Comments

The maximal entry is row n is Fibonacci(n+1), and the smallest missing number is A135510(n). The number of distinct numbers in each row is given by A293160.
It would be nice to have a formula for this sequence, or at least some bounds.

Examples

			Rows 0 through 6 of A002487 are:
0,
1,
1, 2,
1, 3, 2, 3,
1, 4, 3, 5, 2, 5, 3, 4,
1, 5, 4, 7, 3, 8, 5, 7, 2, 7, 5, 8, 3, 7, 4, 5,
1, 6, 5, 9, 4, 11, 7, 10, 3, 11, 8, 13, 5, 12, 7, 9, 2, 9, 7, 12, 5, 13, 8, 11, 3, 10, 7, 11, 4, 9, 5, 6,
To find a(5) we consider the entries 1, 5, 4, 7, 3, 8, 5, 7, 2 in row 5. Ignoring the initial 1 and the final 2, the maximal multiplicity is 2 (for example, 5 appears twice), so a(5) = 2.
From _Don Reble_, Nov 04 2017: (Start)
The initial values of a(n) for n >= 3 together with the terms that have the highest multiplicity are:
3    1 [3]
4    1 [3 4 5]
5    2 [5 7]
6    2 [5 7 9 11]
7    4 [11]
8    5 [13 17]
9    6 [19 23 31 41]
10    8 [23 37 43]
11   12 [71]
12   16 [71]
13   22 [127]
14   29 [109]
15   36 [199 251]
16   48 [263]
17   67 [433]
18   84 [701]
19  118 [839]
20  151 [1193]
21  203 [1801]
22  270 [2693]
23  362 [4229]
24  472 [4349]
25  636 [7759]
26  846 [11287]
27 1142 [14627]
28 1526 [20929]
29 2024 [37243]
30 2736 [43133]
31 3666 [67231]
32 4918 [90227]
33 6550 [127819]
34 8776 [181031]
35 11796 [251071]
36 15824 [394549]
(End)
		

Crossrefs

Programs

  • Maple
    A002487 := proc(n) option remember; if n <= 1 then n elif n mod 2 = 0 then procname(n/2); else procname((n-1)/2)+procname((n+1)/2); fi; end:
    ans:=[];
    for n from 3 to 18 do
    b1:=2^(n-1); b2:=2^n-1; b3:=2^(n-2)-1; mx:=0;
    ar:=Array(0..b1-1,0);
    for k from 1 to b3 do
    kk:=b1+k;
    v:=A002487(kk);
    ar[v]:=ar[v]+1;
    od:
       for k from 0 to b1-1 do if ar[k]>mx then mx:=ar[k]; fi; od:
    ans:=[op(ans),mx];
    od:
    ans;
  • Python
    from itertools import chain, product
    from collections import Counter
    from functools import reduce
    def A293957(n): return 0 if n <= 2 else max(Counter(m for m in (sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if y else (x[0]+x[1],x[1]),chain(k,(1,)),(1,0))) for k in product((False,True),repeat=n-2)) if m != 1 and m != 2).values()) # Chai Wah Wu, Jun 20 2022

Extensions

a(19)-a(36) from Don Reble, Nov 04 2017
Showing 1-3 of 3 results.