spx2 has asked for the wisdom of the Perl Monks concerning the following question:
Is there any regex(without using ?{} or ??{} blocks, backreferences however are allowed)that can test if a number is a power of some other number ?
'1'x$number =~ /REGEX_GOES_HERE/For example, given $number and b, to find if there is any c so that $number=bc(not explicitly finding c, merely proving it exists is enough)
'11111111' =~ /REGEX/ for b=2 would match since there are 8 ones in between quotes
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: check for power of a number with regex
by ikegami (Patriarch) on Oct 26, 2009 at 01:25 UTC | |
Re: check for power of a number with regex
by JavaFan (Canon) on Oct 26, 2009 at 02:38 UTC | |
Re: check for power of a number with regex
by blokhead (Monsignor) on Oct 26, 2009 at 03:47 UTC | |
by JavaFan (Canon) on Oct 26, 2009 at 08:29 UTC | |
by blokhead (Monsignor) on Oct 26, 2009 at 13:37 UTC | |
Re: check for power of a number with regex
by ikegami (Patriarch) on Oct 26, 2009 at 00:55 UTC | |
Re: check for power of a number with regex
by QM (Parson) on Oct 28, 2009 at 03:13 UTC |
Back to
Seekers of Perl Wisdom