Pisano period: Difference between revisions

Content added Content deleted
m (→‎{{header|Perl 6}}: Style tweak, harden against errors. Not necessary for this example but more generally useful)
m (→‎{{header|Factor}}: swap over -> tuck)
Line 34: Line 34:
: pisano-period ( m -- n )
: pisano-period ( m -- n )
[ 0 1 ] dip [ sq <iota> ] [ ] bi
[ 0 1 ] dip [ sq <iota> ] [ ] bi
'[ drop swap over + _ mod 2dup [ zero? ] [ 1 = ] bi* and ]
'[ drop tuck + _ mod 2dup [ zero? ] [ 1 = ] bi* and ]
find 3nip [ 1 + ] [ 1 ] if* ;
find 3nip [ 1 + ] [ 1 ] if* ;