as smarter guys explained, using modulo arithmetic voodoo

Sorry. It's this quote:

The sum of the digits of a number are congruent to the number itself modulo 9. Thus, if A=B*k and A has the same digits as B, then A%9=((B%9)*k)%9.

from here:

https://wlmb.github.io/2025/12/01/PWC350/
He is a scientist, so I trust him :-). E.g. for hex numbers:

my $m = 15; # max digit for my $r ( 0 .. $m ) { # remainder print "$r:\t"; for my $w ( 2 .. $m ) { # witness if ( $r == ( $r * $w ) % $m ) { print "$w " } } print "\n" } # 0: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 # 1: # 2: # 3: 6 11 # 4: # 5: 4 7 10 13 # 6: 6 11 # 7: # 8: # 9: 6 11 # 10: 4 7 10 13 # 11: # 12: 6 11 # 13: # 14: # 15:

Easy to see what to skip. Also (everyone), sorry I overcomplicated with @adjust in pwc_px() and ugly_x, the array and adjustment itself should be omitted; it's leftover from previous approach when I tried pre-determined pattern of steps; now step is always "1" and unfriendly numbers explicitly skipped; so just start from $from. Damn ;-). I'm grateful not to have published yesterday; with a few more blunders; hopefully this "@adjust" is the only left


In reply to Re^2: Faster (but uglier) PWC 350-2 solutions by Anonymous Monk
in thread Faster (but uglier) PWC 350-2 solutions by Anonymous Monk

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.