creating a recursive prime numbers function

hi ,
i wanna write a recursive function that provides me the primer divisors of a given number
for example 63
[3,3,7]
in adition , can u please explain me the recursive there?
thanks a lot!

3 件のコメント

James Tursa
James Tursa 2019 年 8 月 5 日
What have you done so far? What specific problems are you having with your code?
asaf omer
asaf omer 2019 年 8 月 5 日
so far i wrote this ;
function [res]=blah(n)
if n==1 || isprime (n)
res=n;
eles
res=mod(n,blah(n-1))
end
end
i know that i have some problems with the second part
Steven Lord
Steven Lord 2019 年 8 月 5 日
What difficulty are you experiencing with this project?
Do you have an algorithm that you're not sure how to implement? One technique I use in this scenario is to write the steps of the algorithm as comments in the Editor then work my way through, implementing each step in turn. If I'm not sure how to implement a step, I break it up into substeps until I get to pieces I know how to write.
If you don't have an algorithm, since this sounds like a homework assignment does your textbook include such an algorithm?

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品

タグ

質問済み:

2019 年 8 月 5 日

コメント済み:

2019 年 8 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by