Azzera filtri
Azzera filtri

how to find the smallest taxicab number or Ramanujan number like 1729 larger than N?

5 visualizzazioni (ultimi 30 giorni)
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));

Risposta accettata

David Hill
David Hill il 24 Ott 2022
There are so few taxicab numbers that you should just use a lookup table.
l=["2", "1729", "87539319", "6963472309248", "48988659276962496", "24153319581254312065344"];
  3 Commenti
David Hill
David Hill il 24 Ott 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))
ans = 87539319

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Biological and Health Sciences in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by