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.

A057514 Number of peaks in mountain ranges encoded by A014486, number of leaves in the corresponding rooted plane trees (the root node is never counted as a leaf).

This page as a plain text file.
%I A057514 #28 Mar 25 2021 10:21:10
%S A057514 0,1,2,1,3,2,2,2,1,4,3,3,3,2,3,2,3,3,2,2,2,2,1,5,4,4,4,3,4,3,4,4,3,3,
%T A057514 3,3,2,4,3,3,3,2,4,3,4,4,3,3,3,3,2,3,2,3,3,2,3,3,3,2,2,2,2,2,1,6,5,5,
%U A057514 5,4,5,4,5,5,4,4,4,4,3,5,4,4,4,3,5,4,5,5,4,4,4,4,3,4,3,4,4,3,4,4,4,3,3,3,3
%N A057514 Number of peaks in mountain ranges encoded by A014486, number of leaves in the corresponding rooted plane trees (the root node is never counted as a leaf).
%C A057514 Sum_{i=A014137(n)..(A014137(n+1)-1)} a(i) = A001700(n), i.e., A001700(n) gives the total number of leaves in all ordered trees with n + 1 edges.
%H A057514 Indranil Ghosh, <a href="/A057514/b057514.txt">Table of n, a(n) for n = 0..3485</a>
%H A057514 Antti Karttunen, <a href="http://web.archive.org/web/20050429191204/http://ndirty.cute.fi/%7Ekarttu/matikka/Nekomorphisms/gatomorf.htm">Gatomorphisms and other excursions ...</a> (Includes Scheme program)
%H A057514 Antti Karttunen, <a href="https://github.com/karttu/IntSeq/tree/master/src/Uncleaned/Catalania">Newer version of the Scheme code collection</a>
%F A057514 a(n) = A005811(A014486(n))/2 = A000120(A003188(A014486(n)))/2.
%o A057514 (Python)
%o A057514 def a005811(n): return bin(n^(n>>1))[2:].count("1")
%o A057514 def ok(n): # This function after _Peter Luschny_
%o A057514     B=bin(n)[2:] if n!=0 else 0
%o A057514     s=0
%o A057514     for b in B:
%o A057514         s+=1 if b=="1" else -1
%o A057514         if s<0: return 0
%o A057514     return s==0
%o A057514 def A(n): return [0] + [i for i in range(1, n + 1) if ok(i)]
%o A057514 l=A(200)
%o A057514 print([a005811(l[i])//2 for i in range(len(l))]) # _Indranil Ghosh_, May 21 2017
%Y A057514 Cf. A000108, A000120, A001700, A003188, A005811, A014137, A014486, A057515.
%Y A057514 a(n)-1 gives the number of zeros in A071153(n) (for n>=1).
%K A057514 nonn
%O A057514 0,3
%A A057514 _Antti Karttunen_, Sep 03 2000