26
loading...
This website collects cookies to deliver better user experience
$N
.$number >> 4
. We use bitwise arithmetic to get the second nibble, and multiple that by 16 to make it the first.$ ./ch-1.pl 101
86
$ ./ch-1.pl 18
33
$N
and print the $Nth term in the generated sequence.$counter
. I then have a while loop that runs while $counter != 0 and increases the number. I subtract 1 from the $counter if the number only contains 1, 2 and 3s $number =~ /^[123]*$/
and the number doesn't have double 1s index( $number, '11' ) == -1
.$ ./ch-2.pl 5
13
$ ./ch-2.pl 10
32
$ ./ch-2.pl 60
2223
26