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

Home > Numbers
Emir P. Prime (Posted on 2007-04-19) Difficulty: 2 of 5

Can you identify the five-digit sphenic palindrome

  • where the sum of its digits is a palindromic prime,
  • where of one its factors is a multi-digit palindromic prime, and
  • the sum of its factors is also a palindromic prime?

Can you identify any other sphenic palindrome that has these characteristics?

A sphenic number is a positive integer and product of three distinct primes.
A palindromic number is a number that is the same when written forwards or backwards.

See The Solution Submitted by Dej Mar    
Rating: 4.3333 (3 votes)

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

CLS

FOR i = 10000 TO 99999
 n$ = LTRIM$(STR$(i))
 good = 1
 FOR j = 1 TO LEN(n$)
  IF MID$(n$, j, 1) <> MID$(n$, LEN(n$) + 1 - j, 1) THEN good = 0: EXIT FOR
 NEXT
 sod = 0
 FOR j = 1 TO 5
   sod = sod + VAL(MID$(n$, j, 1))
 NEXT
 n$ = LTRIM$(STR$(sod))
 FOR j = 1 TO LEN(n$)
  IF MID$(n$, j, 1) <> MID$(n$, LEN(n$) + 1 - j, 1) THEN good = 0: EXIT FOR
 NEXT
 factor sod, s$
 IF n$ <> LTRIM$(s$) THEN good = 0
 
 IF good THEN
   factor i, s$
   s$ = LTRIM$(RTRIM$(s$))
   ix = INSTR(s$, " ")
   IF ix THEN
     ix2 = INSTR(ix + 1, s$, " ")
     IF ix2 THEN
       ix3 = INSTR(ix2 + 1, s$, " ")
       IF ix3 = 0 THEN
         f1 = VAL(LEFT$(s$, ix - 1))
         f2 = VAL(MID$(s$, ix + 1, ix2 - ix - 1))
         f3 = VAL(MID$(s$, ix2 + 1))
         n$ = LTRIM$(STR$(f1 + f2 + f3))
         FOR j = 1 TO 2
          IF MID$(n$, j, 1) <> MID$(n$, LEN(n$) + 1 - j, 1) THEN good = 0: EXIT FOR
         NEXT
         IF good THEN
           factor f1 + f2 + f3, f$
           IF VAL(f$) = f1 + f2 + f3 THEN
            PRINT i, f1; f2; f3
           END IF
         END IF
       END IF
     END IF
   END IF
 END IF
NEXT

SUB factor (num, s$)
 s$ = "": n = ABS(num): IF n > 0 THEN limit = sqroot(n):  ELSE limit = 0
 IF limit <> INT(limit) THEN limit = INT(limit + 1)
 dv = 2: GOSUB DivideIt
 dv = 3: GOSUB DivideIt
 dv = 5: GOSUB DivideIt
 dv = 7
 DO UNTIL dv > limit
   GOSUB DivideIt: dv = dv + 4 '11
   GOSUB DivideIt: dv = dv + 2 '13
   GOSUB DivideIt: dv = dv + 4 '17
   GOSUB DivideIt: dv = dv + 2 '19
   GOSUB DivideIt: dv = dv + 4 '23
   GOSUB DivideIt: dv = dv + 6 '29
   GOSUB DivideIt: dv = dv + 2 '31
   GOSUB DivideIt: dv = dv + 6 '37
   IF INKEY$ = CHR$(27) THEN s$ = CHR$(27): EXIT SUB
 LOOP
 IF n > 1 THEN s$ = s$ + STR$(n)
 EXIT SUB

DivideIt:
 DO
  q = INT(n / dv)
  IF q * dv = n AND n > 0 THEN
    n = q: s$ = s$ + STR$(dv): IF n > 0 THEN limit = sqroot(n):  ELSE limit = 0
    IF limit <> INT(limit) THEN limit = INT(limit + 1)
   ELSE
    EXIT DO
  END IF
 LOOP
 RETURN
END SUB

finds 32123, with prime factors 7, 13, 353, which add to 373, a prime. The sum of digits of 32123 is 11.


  Posted by Charlie on 2007-04-19 12:05:26
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 (7)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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