問題タブ [perfect-numbers]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
2 に答える
1029 参照

python - Python完全数計算

Python での完全数の計算に問題があります。どうやらコードは VBA で動作しているようなので、構文/インデントに間違いがあると確信しています。助けてください!

これが私のコードです:

0 投票する
0 に答える
286 参照

c - 完全で友好的で社交的な数を計算する C プログラム

Dev C++を使用していますが、プログラムはエラーなしで実行されています。私が抱えている問題は、それが前のサイクルからの数字を繰り返すことであり、それらの数字のいくつが完全、友好的、または単に社交的であるかを計算する効果的な方法がありません.
これがメインプログラムです:

per カウンターと ami カウンターを上げながら、新しいサイクルの開始点として前のサイクルの数値を繰り返さないようにするにはどうすればよいですか? また、許可されていないため、配列を使用することはできません。

0 投票する
1 に答える
471 参照

c - 完全数のリストを作成する C プログラム

これをコーディングしようとしましたが、実行できません。私のコードで何が問題なのかを確認するのを手伝ってください。私が望む結果、例:

これは、ポインターを使用するCプログラムです。

0 投票する
3 に答える
1203 参照

python - Python - 完全数探索の最適化

これは、1 から 50000000 の間で発生するすべての完全数を見つけようとする私のコードです。最初の 3 つの数字は正常に機能し、それらは 1 から 10000 の間です。しかし、進行するにつれて非常に遅くなります。10 秒ごとに 1000 個の数字を処理するようなものです。その後、最終的に 5 秒ごとに 10 個の数字を通過します。

とにかくこれをより速くすることができますか?x を 2 で割って、半分を超えないようにする (x の倍数にはならない) など、いくつかの小さなものを含めてみました。

0 投票する
1 に答える
417 参照

java - Pefect Number Java

Hello this is my first time asking a question here, I read the guidelines and I did look for an answer and did not find one so I hope my question is within the guidelines. Anyway I am stuck on a simple Java exercise where I have to output the first N perfect numbers (In number theory, a perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding the number itself (also known as its aliquot sum).) So I did this

It gets stuck in an infinite loop and i can't figure out why. Anyway if someone can help me I'd really appreciate it and if my question has been answered or if it's just a stupid question sorry, as I said it is my first time asking. Thank you.