I'm too busy right now for code or a proper proof and to be honest I don't grasp your algorithm ...

But my intuition says (examples for [ 2, [1, 0, 5, 0, 1]] )

HTH!

PS: Hey, number theory is off-topic!!! ;-)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

°) regarding sieves, every partial sequence is the combination of all former repeated p-1 times, just the last entry is incremented

for p=2

<0> <1> <0 2> <0 1 0 3> <0 1 0 2 0 1 0 4> <0 1 0 2 0 1 0 3 0 1 0 2 0 1 0 5>

for p=3

<0> <0 1> <0 0 1 0 0 2> <0 0 1 0 0 1 0 0 2 0 0 1 0 0 1 0 0 3>

etc

update

You can easily precalculate the sieves if you have many sequences of a max length like m=32. You'll just calculate the sieve up to m.

Any bigger max entry will just take the place of the precaclclated max and the sieve will be correct.


In reply to Re: checking a set of numbers for consistency mod p by LanX
in thread checking a set of numbers for consistency mod p by hv

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.