Huh! How on earth did you come up with that?

Weirdly (or not) it adapts to the variables in my use case.

Splitting the sequence into 2 parts or 8 parts is a logical extension:

[0] Perl> print join ' ', map $_^14, 0..15;; 14 15 12 13 10 11 8 9 6 7 4 5 2 3 0 1 [0] Perl> print join ' ', map $_^8, 0..15;; 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7

And works for longer sequences (provided they are powers of two; which is a distinct possibility for my purpose):

[0] Perl> print join ' ', map $_^8, 0..31;; 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 24 25 26 27 28 29 30 31 16 17 18 + 19 20 21 22 23 [0] Perl> print join ' ', map $_^16, 0..31;; 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 0 1 2 3 4 5 6 7 8 9 10 + 11 12 13 14 15 [0] Perl> print join ' ', map $_^24, 0..31;; 24 25 26 27 28 29 30 31 16 17 18 19 20 21 22 23 8 9 10 11 12 13 14 15 +0 1 2 3 4 5 6 7 [0] Perl> print join ' ', map $_^28, 0..31;; 28 29 30 31 24 25 26 27 20 21 22 23 16 17 18 19 12 13 14 15 8 9 10 11 +4 5 6 7 0 1 2 3 [0] Perl> print join ' ', map $_^30, 0..31;; 30 31 28 29 26 27 24 25 22 23 20 21 18 19 16 17 14 15 12 13 10 11 8 9 +6 7 4 5 2 3 0 1

Just a shame it produces out-of-bounds values for non-powers-of-two:

[0] Perl> print join ' ', map $_^10, 0..19;; 10 11 8 9 14 15 12 13 2 3 0 1 6 7 4 5 26 27 24 25

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

In reply to Re^2: More simple math. by BrowserUk
in thread More simple math. by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.