in reply to Re^7: checking a set of numbers for consistency mod p (update: still buggy)
in thread checking a set of numbers for consistency mod p
If I read it correctly, you currently make a sieve of length 2 * range, centred around pmax. I think you need the length to be around 2 * (range + pmax - 1).
I don't understand the logic you're using with $max_pos to decide where in the sieve to match, and I'm not sure it's correct. But I'd be tempted to punt on that - make both sieve and input into strings as below, and use a regexp match.
use List::Util qw{min}; my @order = '0' .. '9', 'A' .. 'Z'; # range of 2^36 is probably enou +gh sub to_string { my($max, $list) = @_; return join '', map { defined($_) ? $order[min($_, $max)] : '.' } @$list; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: checking a set of numbers for consistency mod p
by LanX (Saint) on Apr 12, 2022 at 12:24 UTC | |
by hv (Prior) on Apr 12, 2022 at 16:47 UTC | |
by LanX (Saint) on Apr 12, 2022 at 18:55 UTC |