Write a script to generate first 50 members of FUSC Sequence. Please refer to OEIS for more information. The sequence defined as below: fusc(0) = 0 fusc(1) = 1 for n > 1: when n is even: fusc(n) = fusc(n / 2), when n is odd: fusc(n) = fusc((n-1)/2) + fusc((n+1)/2)
Working from home, you decided that on occasion you wanted some background noise while working. You threw together a network streamer to continuously loop through the files and launched it in a tmux (or screen) session, giving it a directory tree of files to play. During the day, you connected an audio player to the… Continue reading Perl Weekly Challenge 103: What’s playing? →
You are given a year $year. Write a script to determine the Chinese Zodiac for the given year $year. Please check out wikipage for more information about it. The animal cycle: Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Goat, Monkey, Rooster, Dog, Pig. The element cycle: Wood, Fire, Earth, Metal, Water.
You are given a positive integer $N. Write a script to produce Hash-counting string of that length. The definition of a hash-counting string is as follows: the string consists only of digits 0-9 and hashes, “#”; there are no two consecutive hashes: “##” does not appear in your string the last character is a hash;… Continue reading Perl Weekly Challenge 102: Hash-counting String →
You are given three points in the plane, as a list of six co-ordinates: A = (x1, y1), B = (x2, y2) and C = (x3, y3). Write a script to find out if the triangle formed by the given three co-ordinates contain origin (0, 0). Print 1 if found otherwise 0.
You are given an array @A of items (integers say, but they can be anything). Your task is to pack that array into an MxN matrix spirally counterclockwise, as tightly as possible. ‘Tightly’ means the absolute value |M-N| of the difference has to be as small as possible.
Something went wrong. Please refresh the page and/or try again.
Follow My Blog
Get new content delivered directly to your inbox.