fly_stright
Versión 1.0.0 (1,62 KB) por
rewanth nayak
A133058 Neil Sloane himself explaining this sequ https://www.youtube.com/watch?v=pAMgUB51XZA
Neil Sloane himself explaining this sequence wrote this simple matlab code after wathching this numberphile video
video link: https://www.youtube.com/watch?v=pAMgUB51XZA
function fly_stright(n)
% A133058
%a(0) = a(1) = 1;
%for n > 1, a(n) = a(n-1) + n + 1
%if a(n-1) and n are coprime,
%otherwise a(n) = a(n-1)/gcd(a(n-1),n).
%source: https://oeis.org/A133058
A=[1,1]; %initialising
for i = 2:n
if gcd(i,A(i)) == 1
%if no comman factor a(n)= a(n-1)+n+1
A(i+1) = A(i)+i+1;
else %a(n)=a(n-1)/gcd(n,a(n-1))
A(i+1) = A(i)/gcd(i,A(i));
end
x=1:length(A); %vector for plotting
scatter(x,A)
end
neil sloane named it fly stright after the scene in avatar where jake scully tried to fly banshee, and coudn't fly it properly until a point.
Citar como
rewanth nayak (2024). fly_stright (https://www.mathworks.com/matlabcentral/fileexchange/113565-fly_stright), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Se creó con
R2022a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS LinuxEtiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.0.0 |