jackfrued / jackfrued/Python-100-Days

day5 找出10000以内的完美数有问题

Open
#752 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
187k
Forks
55.8k
PR merge metrics
No merged PRs in 30d

Description

运行后,出现1,但是根据完美数的定义,是除了自身以外的因子的和恰好等于他本身,那么就不能出现1.下面是我写的,就是很耗资源。。。。
`

def perfect_num():

num_list = []
for i in range(1,10001):
    i_list = []
    for j in range(1,i):
        if i % j == 0:              
            i_list.append(j)
    if sum(i_list) == i :
        num_list.append(i)
print(num_list)`

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Day 5 perfect-number example and run the reported code to reproduce why 1 appears. Check the handling of the lower bound and the divisor loop, then verify that the output contains only perfect numbers below 10000 and does not include 1.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.