This is a bit long, but I'd appreciate the help.
I've been messing about with number series, and now I've managed to confuse myself.
Vampire numbers are those numbers that have an even number of digits. The digits can be mixed and split so that each pair of numbers when multiplied together give the vampire number. For example, 1,435 is a vampire number as you can get 35 * 41 from it, so is 2,187 (27 * 81)
I've managed to write a program to work out the vampire numbers for 4 digit numbers, now I'm working on the 6 digit ones. These are going to have 2, 3 digit numbers as the "fangs". Which give this number series its name.
I've got the numbers into a string then split the string into individual digits and put these into an array using
VampLen = LEN(LTRIM$(VampStr$))
FOR Count = 1 TO VampLen
VampAry$(Count) = MID$(VampStr$, Count, 1)
NEXT Count
I used a bunch of SWAP statements to change the order of the array when creating and testing the 2 digit numbers for the 4 figure vampire numbers.
ReCurs = ReCurs + 1
SELECT CASE ReCurs
CASE 1
SWAP VampAry$(1), VampAry$(2)
CASE 2
SWAP VampAry$(1), VampAry$(2)
SWAP VampAry$(3), VampAry$(4)
CASE 3
SWAP VampAry$(1), VampAry$(2)
CASE 4
SWAP VampAry$(1), VampAry$(2)
SWAP VampAry$(2), VampAry$(3)
CASE 5
SWAP VampAry$(3), VampAry$(4)
CASE 6
SWAP VampAry$(1), VampAry$(2)
CASE 7
SWAP VampAry$(3), VampAry$(4)
CASE 8
SWAP VampAry$(1), VampAry$(2)
SWAP VampAry$(2), VampAry$(4)
CASE 9
SWAP VampAry$(3), VampAry$(4)
CASE 10
SWAP VampAry$(1), VampAry$(2)
CASE 11
SWAP VampAry$(3), VampAry$(4)
END SELECT
If I try to do this creating the 2, 3 digit numbers for 6 digit vampire numbers I'm going to end up writing at least 350 swap statements. Can anyone suggest a quicker way of creating all the possible position variations for these numbers? I know I'm going to have to do at least 405,450 calculataions for these numbers, and over 40 million if I extend the program to 8 digit numbers, so any help will be greatly appreciated.
If I've managed to confuse anyone besides myself, think of this. I want all possible positional combinations of the string ABCDEF, such as ACBDEF, ACDBEF etc. etc. For my purposes ABC DEF is the same as DEF ABC but I can take care of the duplications myself.
If you'd like to know more about vampire numbers then see and
Ray
I've been messing about with number series, and now I've managed to confuse myself.
Vampire numbers are those numbers that have an even number of digits. The digits can be mixed and split so that each pair of numbers when multiplied together give the vampire number. For example, 1,435 is a vampire number as you can get 35 * 41 from it, so is 2,187 (27 * 81)
I've managed to write a program to work out the vampire numbers for 4 digit numbers, now I'm working on the 6 digit ones. These are going to have 2, 3 digit numbers as the "fangs". Which give this number series its name.
I've got the numbers into a string then split the string into individual digits and put these into an array using
VampLen = LEN(LTRIM$(VampStr$))
FOR Count = 1 TO VampLen
VampAry$(Count) = MID$(VampStr$, Count, 1)
NEXT Count
I used a bunch of SWAP statements to change the order of the array when creating and testing the 2 digit numbers for the 4 figure vampire numbers.
ReCurs = ReCurs + 1
SELECT CASE ReCurs
CASE 1
SWAP VampAry$(1), VampAry$(2)
CASE 2
SWAP VampAry$(1), VampAry$(2)
SWAP VampAry$(3), VampAry$(4)
CASE 3
SWAP VampAry$(1), VampAry$(2)
CASE 4
SWAP VampAry$(1), VampAry$(2)
SWAP VampAry$(2), VampAry$(3)
CASE 5
SWAP VampAry$(3), VampAry$(4)
CASE 6
SWAP VampAry$(1), VampAry$(2)
CASE 7
SWAP VampAry$(3), VampAry$(4)
CASE 8
SWAP VampAry$(1), VampAry$(2)
SWAP VampAry$(2), VampAry$(4)
CASE 9
SWAP VampAry$(3), VampAry$(4)
CASE 10
SWAP VampAry$(1), VampAry$(2)
CASE 11
SWAP VampAry$(3), VampAry$(4)
END SELECT
If I try to do this creating the 2, 3 digit numbers for 6 digit vampire numbers I'm going to end up writing at least 350 swap statements. Can anyone suggest a quicker way of creating all the possible position variations for these numbers? I know I'm going to have to do at least 405,450 calculataions for these numbers, and over 40 million if I extend the program to 8 digit numbers, so any help will be greatly appreciated.
If I've managed to confuse anyone besides myself, think of this. I want all possible positional combinations of the string ABCDEF, such as ACBDEF, ACDBEF etc. etc. For my purposes ABC DEF is the same as DEF ABC but I can take care of the duplications myself.
If you'd like to know more about vampire numbers then see and
Ray