Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: Determining if a rational number terminates

by tobyink (Abbot)
on Nov 29, 2012 at 20:13 UTC ( #1006349=note: print w/replies, xml ) Need Help??


in reply to Re^3: Determining if a rational number terminates
in thread Determining if a rational number terminates

Meh... I was actually only checking multiples of five. D'oh! 1/15 was reporting "Y".

Fixed...

@ARGV = (15, 40); sub _{@i=sort{$b-$a}@_;return$i[1]if$i[0]==$i[1];@i=($i[1],$i[0]%$i[1 ])while$i[1];$i[0]}sub __{$j=_@_;$_/=$j for@_;$_[1]<0and do{$_*=-1for @_}}__(($k,$l)=@ARGV);for(2,5){$l/=$_ until$l%$_}print$l eq 1?Y:N,$/#
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006349]
help
Chatterbox?
[marioroy]: might need to backslash \'*.mp3\'
[marioroy]: It's a quoting issue inside qx. It's File::Find or qx. LA chooses qx. Almost there.
[marioroy]: Also \"%S\\\n\" oh my, not fun.
[Discipulus]: good night folks
[marioroy]: I will make a mp3info script that takes the -p "%S\n" args and test qx. I'm on the road, so will come back.
[marioroy]: All because File::Find is not fun for LA.
[marioroy]: good night Discipulus.
[Discipulus]: perl dreams to you all

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2017-04-23 21:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.