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

Home > Numbers
A 3-digit number (Posted on 2018-10-27) Difficulty: 3 of 5
What is the smallest palindromic prime whose cube can be expressed as the sum of three odd cubes ?

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
actual solution | Comment 8 of 13 |
As Ady pointed out - I accidentally solved a different problem. I should have found a palindromic prime whose cube is the sum of three odd numbers cubed. So, now then, here it is: 

(BTW - isn't "now then" oxymoronic?)

rabbit-3:~ lord$ t3a

   929^3  =    69^3    +    447^3    +   1347^3


program t3

        use iso_fortran_env

        implicit none

        integer (kind=int64) y3(1000,4),num(8),i1,i2,i3,icnt,

        1 i,j,ndig,n,root,half,root3,dum,jj,k,pcnt,lim,a3

        lim=4001

        icnt=0

        pcnt=0

        a3=3

           do i1=1,lim-4,2

                do i2=i1+2,lim-2,2

                   do 4 i3=i2+2,lim,2

                   dum=i1**a3+i2**a3+i3**a3

                   root=(1.*dum)**(1/3.)

                   root3=root**a3

                   if(root3.ne.dum)go to 4

                   icnt=icnt+1

                   y3(icnt,1)=i1

                   y3(icnt,2)=i2

                   y3(icnt,3)=i3

                   y3(icnt,4)=root

4                  enddo

                enddo

           enddo

           do 1 k=1,icnt

           i=y3(k,4)

           call isprime(i,n)

           if (n.eq.0)go to 1

           pcnt=pcnt+1

           ndig=log10(1.*i)+1

           dum=i

                do j=ndig-1,1,-1

                num(j+1)=dum/10**j

                dum=dum-num(j+1)*10**j

                enddo

           num(1)=dum

           half=(ndig+1)/2

                do j=1,half

                if(num(j).ne.num(ndig+1-j))go to 1

                enddo

                print 3,y3(k,4),y3(k,1),y3(k,2),y3(j,3)

3               format(i6, '^3  =',2(2x,i4,'^3    + '),2x,i4,'^3')

1          enddo

        end


       subroutine isprime(i,n)

        use iso_fortran_env

        implicit none

        integer (kind=int64)  i,j,k,l,m,n

        n=1

        if(i.eq.2)return

        n=0

        k=sqrt(1.*i)

           do j=2,k

           m=(1.*i)/(1.*j)

           l=m*j

           if(l.eq.i)go to 1

           enddo

        n=1

1       return

       end


Edited on February 9, 2019, 4:29 pm
  Posted by Steven Lord on 2019-02-09 11:59:12

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 (8)
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