Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A082008
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A082008 a(n) = A082007(n-1) + 1. +0
3
1, 2, 3, 4, 7, 10, 13, 5, 6, 8, 9, 11, 12, 14, 15, 16, 31, 46, 61, 76, 91, 106, 121, 136, 151, 166, 181, 196, 211, 226, 241, 17, 18, 32, 33, 47, 48, 62, 63, 77, 78, 92, 93, 107, 108, 122, 123, 137, 138, 152, 153, 167, 168, 182, 183, 197, 198 (list; graph; listen)
OFFSET

1,2

COMMENT

Contribution from Steve Witham (sw(AT)tiac.net), Oct 13 2009: (Start)

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.

This sequence is a permutation of the integers >= 1. (End)

LINKS

Steve Witham, Clumpy Heapsort

Steve Witham, Clumpy Heapsort. [From Steve Witham (sw(AT)tiac.net), Oct 13 2009]

FORMULA

May be defined recursively by:

def A082008( n ):

if n == 1: return 1

y = 2 ** int( log( n, 2 ) )

yc = 2 ** 2 ** int( log( log( y, 2 ), 2 ) )

yr = y / yc

return (yc-1) * int( (n-y) / yr + 1 ) + A082008( yr + n % yr ) (from Steve Witham, Oct 14 2009)

PROGRAM

Contribution from Steve Witham (sw(AT)tiac.net), Oct 13 2009: (Start)

(Python) \D def A082008( n ):

..if n == 1: return 1

..

..y = 2 ** int( log( n, 2 ) )

..yc = 2 ** 2 ** int( log( log( y, 2 ), 2 ) )

..yr = y / yc

..return (yc-1) * int( (n-y) / yr + 1 ) + A082008( yr + n % yr )

(End)

CROSSREFS

Sequence in context: A104519 A117220 A118426 this_sequence A105330 A097545 A073627

Adjacent sequences: A082005 A082006 A082007 this_sequence A082009 A082010 A082011

KEYWORD

nonn,tabf

AUTHOR

N. J. A. Sloane (njas(AT)research.att.com), Oct 06 2009, based on a posting by Steve Witham (sw(AT)tiac.net) to the Math Fun Mailing List, Sep 30 2009

EXTENSIONS

The origin is 1 Steve Witham (sw(AT)tiac.net), Oct 13 2009

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified November 25 20:09 EST 2009. Contains 167514 sequences.


AT&T Labs Research