Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
LabVIEW Zone LabVIEW Tools Network Resources LabVIEW Champions Student Corner User Groups Discussion Forum Code Sharing Learning Center

Coding Challenge - Vampire Numbers Challenge - Results

 Challenge Description:

The goal of this Challenge was to build an application that returns all Vampire Numbers within a given range. A vampire number is an integer
  • with an even number of digits
  • with a pair of factors (called the fangs) having two properties:
    1. they have an equal number of digits
    2. together, they possess exactly the same digits as the vampire number
    3. not gotten by simply adding zeros to the end of a smaller vampire number

The submissions for this contest were judged on three criteria:

The first was accuracy. The VI must successfully find all of the Vampire Numbers in a given range. This could be integers with a small number of digits, or integers with more digits than many data types can hold. The next criterion was speed. For those submissions that did find all Vampire Numbers in a given range, how fast could they find these? Finally, and very importantly, submissions were judged on code readability. Even if a VI performs a specific task, it must be readable by other programmers and follow LabVIEW Style Guidelines.

  Coding Challenge Winner

  Christian Altenbach, from UCLA, is the Vampire Number Coding Challenge winner! His submission efficiently returned Vampire Numbers in wide ranges of numbers and also displayed good LabVIEW programming style.

 Winning Entry Description:

1. Accuracy: To determine Vampire Numbers which contain more digits than a simple integer will hold, Christian devised the following plan. In his application, the raw "beginning" and "end" boundaries are used to generate individual ranges. All parts with an odd number of digits or less than 4 digits are eliminated. Each range with an equal number of digits is treated separately. The digit count determines which version of basically the same search code is executed:

4-8 digits: I32 based
10-14 digits: DBL based
16 digits: EXT based
18+ digits: Unf (Unsigned integer of infinite precision) based, represented as array of digits.)

He also built set of Unf math tools (multiply, add, increment, etc.) that make certain assumptions about the data. And in these VIs, Unf multiplication is Fourier based (base 10).

By developing this structure, Christian's VI found the correct amount of Vampire Numbers in each of the ranges tested. They were as follows:

Range of Numbers Tested # Vampire Numbers Found
1 - 10,000 7
1 - 1,000,000 155
1 - 100,000,000 3383
0 - 999,999,999 5184
1000000000-1001000000 9
900000000000-900020000000 3
99900000000000-99999999999999 76
10000000000000-10000100000000 17

2. Speed: All submissions were run on a Dell Dimension computer with a 2.4 GHz Pentium 4 processor and 512MB RAM. Christian's VI was the only submission which found all Vampire Numbers for each range tested in reasonable time. His submission completed the ranges in the specified times:

Range of Numbers Tested Time to Find all Vampire Numbers
1 - 10,000 1 millisecond
1 - 1,000,000 55 milliseconds
1 - 100,000,000 5.2 seconds
0 - 999,999,999 5.2 seconds
1000000000-1001000000 458 milliseconds
900000000000-900020000000 480 milliseconds
99900000000000-99999999999999 9.5 seconds
10000000000000-10000100000000 47.7 seconds

Honorable Mention:
Heiko Fettig, from Bookham Technology, also submitted an excellent solution. Although it did not find Vampire Numbers in all ranges within reasonable time, it performed extremely well, sometimes faster, in others. Heiko's VI successfully found the correct Vampire Numbers in the following ranges within the listed time:

Range of Numbers Tested Time to Find all Vampire Numbers
Range of Numbers Tested Time to Find all Vampire Numbers
1 - 10,000 9 milliseconds
1 - 1,000,000 42.6 milliseconds
0 - 999,999,999 4.1 seconds

3. Coding Style: Even when a VI correctly performs a specific task, it is also important that the VI be readable by other developers. Christian's VI was coded very well

  • Front Panel
    • Well organized
    • Contained to one font
    • Object evenly aligned and distributed
 
  • Block Diagram
  • Clean wiring techniques (very important!)
  • Efficient memory management (minimization of data copies)
  • Very good use of comments
  • Though top-level VI Block Diagram was larger than screen size, it was only necessary to scroll in one direction
 
enlarge
  • Icon and Connector Pane
 Very unique, descriptive icons 
No colloquialisms on icons
Honorable Mention:
Heiko Fettig, from Bookham Technology, also rated very well in this category. His Block Diagrams were very clean and, again, he created come excellent icons for his application. The entire Block Diagram for his top-level VI is below:

Notice the clear user of comments and compact nature of his Block Diagram. It is easy to follow and clean of messy wires.

Again, thank you to everyone who competed in this competition. And congratulations to Christian Altenbach, the overall winner for the Vampire Numbers Coding Challenge. Be sure to check out the current Coding Challenge for even more LabVIEW fun!