Arithmetic/Rational: Difference between revisions
→{{header|J}}
Line 684:
is_perfect_rational=: 2= +/@:%@,@factors</lang>
Exhaustive testing would take forever:
<lang j> I.is_perfect_rational@"0 i.2^19
6 28 496 8128
I.is_perfect_rational@x:@"0 i.2^19x
6 28 496 8128</lang>
More limited testing takes reasonable amounts of time:
<lang j> (#~ is_perfect_rational"0) (* <:@+:) 2^i.10x
6 28 496 8128</lang>
|