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

Home > Numbers
Pandigital and Doubly Pandigital (Posted on 2009-06-02) Difficulty: 3 of 5
Determine all possible triplet(s) (P, Q, N), where each of P and Q is a five digit positive base ten integer with P > Q and P*Q = N, such that:

  • P and Q together contain each of the digits from 0 to 9 exactly once, and:
  • N contains each of the digits from 0 to 9 exactly once, and:
  • N2 contains each of the digits from 0 to 9 exactly twice. Neither N nor N2 can contain any leading zero.

See The Solution Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 2
   5   dim Dct(9)
  10   Pq="1023456789":H=Pq
  15   loop
  20   Ps=left(Pq,5):Qs=right(Pq,5)
  25   if Ps>Qs and left(Qs,1)<>"0" then
  30    :P=val(Ps):Q=val(Qs):N=P*Q
  40    :Ns=cutspc(str(N))
  50    :if len(Ns)=10 then
  55      :Good=1
  60      :for I=1 to 9
  65         :if instr(I+1,Ns,mid(Ns,I,1))>0 then Good=0:endif
  70      :next
  75      :if Good then
  80        :Ns2=cutspc(str(N*N))
  85        :if len(Ns2)=20 then
  90          :for I=0 to 9:Dct(I)=0:next
 100          :for I=1 to 20
 105             :inc Dct(val(mid(Ns2,I,1)))
 110             :if Dct(val(mid(Ns2,I,1)))>2 then Good=0:endif
 120          :next
 130          :if Good then print P;Q;N;Ns2:endif
 132        :endif
 200   gosub *Permute(&Pq)
 210   if left(Pq,1)="0" then goto 800
 250   endloop
 800   end

(The permute subroutine is described elsewhere on the site.)

This finds:

62037  54981  3410856297  11633940678784552209

as P, Q, N and N^2. No other solutions were found.


  Posted by Charlie on 2009-06-02 14:02:33
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 (19)
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