how to find the smallest taxicab number or Ramanujan number like 1729 larger than N?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Daniel Niu
el 24 de Oct. de 2022
Comentada: Daniel Niu
el 24 de Oct. de 2022
I write a .m file to find the a b c d of a taxicab number. The program run well when the num=1729 or some other taxicab number.
But when the num is not a taxicab, the program reture a empty.
I want to know how to find the smallest number large than for example 40000 and find the a b c d
And how to find the first few of taxicab number?
a^3+b^3=c^3+d^3
Your help would be highly appreciated!
clear
format long
num=1729;
b = 1:(num)^(1/3);
a = (num-b.^3).^(1/3);
condition=round(a,10)==round(a,5);
terms = find(condition);
taxicab=round(a(terms));
0 comentarios
Respuesta aceptada
David Hill
el 24 de Oct. de 2022
There are so few taxicab numbers that you should just use a lookup table.
l=["2", "1729", "87539319", "6963472309248", "48988659276962496", "24153319581254312065344"];
3 comentarios
David Hill
el 24 de Oct. de 2022
Bute force
[a,b]=meshgrid(1:500);
t=a.^3+b.^3;
u=unique(t);
h=histc(t(:),u);
f=find(h==6);
min(u(f))
Más respuestas (0)
Ver también
Categorías
Más información sobre Biological and Health Sciences en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!