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.

A174980 Stern's diatomic series type ([0,1], 1).

This page as a plain text file.
%I A174980 #35 Aug 11 2025 07:11:24
%S A174980 0,0,1,0,2,1,1,0,3,2,3,1,2,1,1,0,4,3,5,2,5,3,4,1,3,2,3,1,2,1,1,0,5,4,
%T A174980 7,3,8,5,7,2,7,5,8,3,7,4,5,1,4,3,5,2,5,3,4,1,3,2,3,1,2,1,1,0,6,5,9,4,
%U A174980 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,1,5,4,7,3,8
%N A174980 Stern's diatomic series type ([0,1], 1).
%C A174980 A variant of Stern's diatomic series A002487. See the link [Luschny] and the Maple function below for the classification by types which is based on a generalization of Dijkstra's fusc function.
%C A174980 a(n) is also the number of superduperbinary integer partitions of n.
%C A174980 It appears that a(n) is equal to the multiplicative inverse of A002487(n+2) mod A002487(n+1). - _Gary W. Adamson_, Dec 23 2023
%H A174980 Peter Luschny, <a href="/A174980/b174980.txt">row(n) for n = 0..12</a>
%H A174980 Edsger Dijkstra, <a href="http://www.cs.utexas.edu/users/EWD/ewd05xx/EWD578.PDF">EWD 578: More about the function 'fusc'</a>, Selected Writings on Computing, Springer, 1982, p. 232.
%H A174980 Peter Luschny, <a href="http://www.oeis.org/wiki/User:Peter_Luschny/SternsDiatomic">Rational Trees and Binary Partitions</a>.
%H A174980 Moritz A. Stern, <a href="https://gdz.sub.uni-goettingen.de/id/PPN243919689_0055">Über eine zahlentheoretische Funktion</a>, J. Reine Angew. Math., 55 (1858), 193-220.
%F A174980 Recursion: a(2n + 1) = a(n) and a(2n) = a(n - 1) + a(n) + [n = 2^k] for n = 1, a(0) = 0. [n = 2^k] is 1 if n is a power of 2, 0 otherwise.
%e A174980 The sequence splits into rows of length 2^k:
%e A174980   0,
%e A174980   0, 1,
%e A174980   0, 2, 1, 1,
%e A174980   0, 3, 2, 3, 1, 2, 1, 1,
%e A174980   0, 4, 3, 5, 2, 5, 3, 4, 1, 3, 2, 3, 1, 2, 1, 1,
%e A174980   ...
%e A174980 .
%e A174980 The first few partitions counted are:
%e A174980 [ 0], []
%e A174980 [ 1], []
%e A174980 [ 2], [[2]]
%e A174980 [ 3], []
%e A174980 [ 4], [[4], [2, 2]]
%e A174980 [ 5], [[4, 1]]
%e A174980 [ 6], [[4, 1, 1]]
%e A174980 [ 7], []
%e A174980 [ 8], [[8], [4, 4], [2, 2, 2, 2]]
%e A174980 [ 9], [[8, 1], [4, 4, 1]]
%e A174980 [10], [[8, 2], [8, 1, 1], [4, 4, 1, 1]]
%e A174980 [11], [[8, 2, 1]]
%e A174980 [12], [[8, 2, 2], [8, 2, 1, 1]]
%e A174980 [13], [[8, 2, 2, 1]]
%e A174980 [14], [[8, 2, 2, 1, 1]]
%e A174980 [15], []
%e A174980 [16], [[16], [8, 8], [4, 4, 4, 4], [2, 2, 2, 2, 2, 2, 2, 2]]
%e A174980 [17], [[16, 1], [8, 8, 1], [4, 4, 4, 4, 1]]
%e A174980 [18], [[16, 2], [8, 8, 2], [16, 1, 1], [8, 8, 1, 1], [4, 4, 4, 4, 1, 1]]
%e A174980 [19], [[16, 2, 1], [8, 8, 2, 1]]
%e A174980 [20], [[16, 4], [16, 2, 2], [8, 8, 2, 2], [16, 2, 1, 1], [8, 8, 2, 1, 1]]
%e A174980 [21], [[16, 4, 1], [16, 2, 2, 1], [8, 8, 2, 2, 1]]
%e A174980 [22], [[16, 4, 2], [16, 4, 1, 1], [16, 2, 2, 1, 1], [8, 8, 2, 2, 1, 1]]
%e A174980 [23], [[16, 4, 2, 1]]
%e A174980 [24], [[16, 4, 4], [16, 4, 2, 2], [16, 4, 2, 1, 1]]
%p A174980 SternDijkstra := proc(L, p, n) local k, i, len, M; len := nops(L); M := L; k := n; while k > 0 do M[1+(k mod len)] := add(M[i], i=1..len); k := iquo(k, len); od; op(p, M) end:
%p A174980 a := n -> SternDijkstra([0,1], 1, n);
%t A174980 a[0] = 0; a[n_?OddQ] := a[n] = a[(n-1)/2]; a[n_?EvenQ] := a[n] = a[n/2 - 1] + a[n/2] + Boole[ IntegerQ[ Log[2, n/2]]]; Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Jul 26 2013 *)
%o A174980 (SageMath)
%o A174980 def A174980(n):
%o A174980     M = [0, 1]
%o A174980     for b in n.bits():
%o A174980         M[b] = M[0] + M[1]
%o A174980     return M[0]
%o A174980 print([A174980(n) for n in (0..100)]) # _Peter Luschny_, Nov 28 2017
%o A174980 (Python) # Generating the partitions.
%o A174980 def SDBinaryPartition(n):
%o A174980     def Double(W, T):
%o A174980         B = []
%o A174980         for L in W:
%o A174980             A = [a*2 for a in L]
%o A174980             if T > 0: A += [1]*T
%o A174980             B.append(A)
%o A174980         return B
%o A174980     if n == 2: return [[2]]
%o A174980     if n <  4: return []
%o A174980     h = n // 2
%o A174980     H = SDBinaryPartition(h)
%o A174980     B = Double(H, n % 2)
%o A174980     if n % 2 == 0:
%o A174980         H = SDBinaryPartition(h - 1)
%o A174980         if H != []: B += Double(H, 2)
%o A174980         if (n & (n - 1)) == 0: B.append([2]*h)
%o A174980     return B
%o A174980 for n in range(25): print([n], SDBinaryPartition(n)) # _Peter Luschny_, Sep 02 2019
%Y A174980 Cf. A002487, A070879, A047679, A007306, A174981, A140429 (row sums), A086449.
%K A174980 easy,nonn,tabf,look
%O A174980 0,5
%A A174980 _Peter Luschny_, Apr 03 2010