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

Home > Numbers
Powerful and consecutive (Posted on 2010-08-09) Difficulty: 4 of 5
Powerful numbers (4,8,9,16,25,27... )are defined as follows: if a prime p divides n then p2 must also divide n.
(8,9) is a couple of two consecutive numbers,both of them being powerful.
Find another pair(s) like that.

The more the merrier!!

No Solution Yet Submitted by Ady TZIDON    
Rating: 3.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts computer findings | Comment 8 of 16 |

DECLARE FUNCTION powerful# (num#)
DEFDBL A-Z
CLS
FOR i = 1 TO 1000000
  IF powerful(i) THEN
    IF prev THEN PRINT i - 1; i
    prev = 1
  ELSE
    prev = 0
  END IF
NEXT

FUNCTION powerful (num)
  n = ABS(num): IF n > 0 THEN limit = SQR(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 EXIT FUNCTION
 LOOP
 IF n > 1 THEN powerful = 0:   ELSE powerful = 1
 EXIT FUNCTION

DivideIt:
 rep = 0
 DO
  q = INT(n / dv)
  IF q * dv = n AND n > 0 THEN
    n = q
    rep = rep + 1
    IF n > 0 THEN limit = SQR(n):  ELSE limit = 0
    IF limit <> INT(limit) THEN limit = INT(limit + 1)
   ELSE
    EXIT DO
  END IF
 LOOP
 IF rep = 1 THEN powerful = 0: EXIT FUNCTION
 RETURN
END FUNCTION

finds

 8  9
 288  289
 675  676
 9800  9801
 12167  12168
 235224  235225
 332928  332929
 465124  465125
 
giving all such pairs that lie under one million.

The powerful function is a modification of an algorithm for factoring into primes.


  Posted by Charlie on 2010-08-09 14:29:07
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 (16)
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