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.

A082008 a(n) = A082007(n-1) + 1.

This page as a plain text file.
%I A082008 #19 May 13 2025 08:26:37
%S A082008 1,2,3,4,7,10,13,5,6,8,9,11,12,14,15,16,31,46,61,76,91,106,121,136,
%T A082008 151,166,181,196,211,226,241,17,18,32,33,47,48,62,63,77,78,92,93,107,
%U A082008 108,122,123,137,138,152,153,167,168,182,183,197,198
%N A082008 a(n) = A082007(n-1) + 1.
%C A082008 From Steve Witham (sw(AT)tiac.net), Oct 13 2009: (Start)
%C A082008 Starting the sequence (and its index) at 1 (as in A082008) instead of 0 (as in A082007) seems more natural. This was conceived as a way to arrange a heapsort in memory to improve locality of reference. The classic Williams/Floyd heapsort also works a little more naturally when the origin is 1.
%C A082008 This sequence is a permutation of the integers >= 1. (End)
%C A082008 Moreover, the first 2^2^n - 1 terms are a permutation of the first 2^2^n - 1 positive integers. - _Ivan Neretin_, Mar 12 2017
%H A082008 Ivan Neretin, <a href="/A082008/b082008.txt">Table of n, a(n) for n = 1..8191</a>
%H A082008 Steve Witham, <a href="http://www.mac-guyver.com/switham/2009/10/Clumpy_heapsort/index.html">Clumpy Heapsort</a>.
%t A082008 w = {{1}}; Do[k = 2^Floor@Log2[n - 1]; AppendTo[w, Flatten@Table[w[[n - k]] + (2^k - 1) i, {i, 2^k}]], {n, 2, 7}]; a = Flatten@w (* _Ivan Neretin_, Mar 12 2017 *)
%o A082008 (Python)
%o A082008 def A082008( n ):
%o A082008     if n == 1: return 1
%o A082008     y = 2 ** int( log( n, 2 ) )
%o A082008     yc = 2 ** 2 ** int( log( log( y, 2 ), 2 ) )
%o A082008     yr = y // yc
%o A082008     return (yc-1) * int( (n-y) / yr + 1 ) + A082008( yr + n % yr )
%o A082008 # Steve Witham (sw(AT)tiac.net), Oct 13 2009
%K A082008 nonn,tabf
%O A082008 1,2
%A A082008 _N. J. A. Sloane_, Oct 06 2009, based on a posting by Steve Witham (sw(AT)tiac.net) to the Math Fun Mailing List, Sep 30 2009
%E A082008 The origin is 1 Steve Witham (sw(AT)tiac.net), Oct 13 2009