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

Home > Just Math
Recover a number (Posted on 2019-10-29) Difficulty: 2 of 5
A certain positive integer N is twice the product of its digits.

Find N.

See The Solution Submitted by Ady TZIDON    
No Rating

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

Note - one need only search numbers up to n digits, where 

2 x 9^n > 10^n  

So n is less than or equal to 6. After that the equality is impossible since  at n=7, 10^ 7 > 2 * 9*9*9*9*9*9*9    

        program pu

        implicit none

        integer i,j,dum,prod,top,dig

           do i = 1, 10**7

           prod=1

           dum=i

                top=log10(1.*i)

                do j=top,0,-1

                dig=dum*10.**(-j)

                prod=prod*dig

                dum=dum-dig*10**j

                enddo

           if(2*prod.eq.i)print*,i

           enddo

        end

rabbit-3:~ lord$ pu

          36

rabbit-3:~ lord$

Edited on October 29, 2019, 11:52 am
  Posted by Steven Lord on 2019-10-29 09:57: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 (23)
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