What is the smallest palindromic prime whose cube can be expressed as the sum of three odd cubes ?
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