All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Vampire numbers (Posted on 2012-10-31) Difficulty: 3 of 5
A "vampire number" is an integer with 2n digits that is the product of two n-digit numbers the fangs whose digits, when combined, form a permutation of the original digits (thus, multiplicity counts).

The smallest vampire numbers are 1260 (= 21 60) and 1395 (= 15 93). Technical point: The fangs cannot each end in a 0. So 126000 is not a vampire number.

You might have missed it, but October 5, 2010, was a vampire day because 10 05 2010 is an 8-digit vampire number. It equals 2010 5001. When is the next vampire day?

No Solution Yet Submitted by Danish Ahmed Khan    
Rating: 5.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 2 of 3 |

DECLARE SUB permute (a$)
DEFDBL A-Z
OPEN "vampire nos.txt" FOR OUTPUT AS #2

mo = 10: da = 5: ye = 2010
GOSUB greg.to.jd
jd0 = jd
FOR j = jd0 TO jd0 + 365.25 * 100
    jd = j
    GOSUB jd.to.greg
    mm$ = LTRIM$(STR$(mo))
    IF LEN(mm$) < 2 THEN mm$ = "0" + mm$
    dd$ = LTRIM$(STR$(da))
    IF LEN(dd$) < 2 THEN dd$ = "0" + dd$
    year$ = LTRIM$(STR$(ye))
    a$ = mm$ + dd$ + year$: h$ = a$
    n = VAL(a$)
    DO
        f1 = VAL(LEFT$(a$, 4))
        f2 = VAL(RIGHT$(a$, 4))
        IF f1 * f2 = n THEN
            PRINT mo; da; ye, f1; f2
            PRINT #2, mo; da; ye, f1; f2
        END IF
        permute a$
    LOOP UNTIL a$ = h$
NEXT
CLOSE

END

greg.to.jd:
10100 REM :greg mo/da/ye --> jd at noon
10110 GOSUB jul.to.jd
10120 jd = jd + 2 - INT(cw(1) / 100) + INT(cw(1) / 400)
10130 RETURN
jul.to.jd:
10150 REM :jul mo/da/ye --> jd at noon
10160 cw(0) = mo: cw(1) = ye: IF mo < 3 THEN cw(0) = mo + 12: cw(1) = ye - 1
10170 jd = INT(365.25 * cw(1)) + INT(30.61 * (cw(0) + 1)) + da + 1720995!
10180 RETURN
jd.to.greg:
10200 REM:noon jd-->greg mo/da/ye
10210 cw(0) = INT((jd - 1867216.25#) / 36524.25)
10220 cw(0) = jd + 1 + cw(0) - INT(cw(0) / 4)
10230 GOTO common.from.jd
jd.to.jul:
10240 REM : noon jd-->jul mo/da/ye
10250 cw(0) = jd
common.from.jd:
10260 cw(0) = cw(0) + 1524
10265 cw(1) = INT((cw(0) - 122.1) / 365.25)
10270 cw(2) = INT(365.25 * cw(1))
10275 cw(3) = INT((cw(0) - cw(2)) / 30.6001)
10280 da = cw(0) - cw(2) - INT(30.61 * cw(3))
10285 ye = cw(1) - 4716
10290 mo = cw(3) - 1: IF mo > 12 THEN mo = mo - 12: ye = ye + 1
10295 RETURN

 

finds, for a hundred-year period:

 10  5  2010   2010  5001 
 10  5  2010   5001  2010
 7  29  2043   2409  3027
 7  29  2043   3027  2409
 5  12  2048   2048  2501
 5  12  2048   2501  2048
 12  5  2048   1502  8024
 12  5  2048   8024  1502
 10  5  2064   2004  5016
 10  5  2064   5016  2004
 1  26  2079   201  6279
 1  26  2079   6279  201
 5  21  2084   2084  2501
 5  21  2084   2501  2084
 7  19  2089   921  7809
 7  19  2089   7809  921
 1  5  2100    210  5010
 1  5  2100    501  2100
 1  5  2100    1002  1050
 1  5  2100    1050  1002
 1  5  2100    2100  501
 1  5  2100    5010  210
 9  6  2104    1004  9026
 9  6  2104    9026  1004

Those where the month number has only one digit are only pseudo-vampire, as the product is only nine digits, in keeping with the fact that the number formed from the date has a leading zero if specified as eight digits.

That makes the next true vampire day December 5, 2048, using a leading zero only on the date portion, as in the October 5 example. Then October 5, 2064 is the only other vampire day in the 100-year period that starts with the 2010 vampire day.


  Posted by Charlie on 2012-10-31 12:45:40
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information