Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5957893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:27:57+00:00 2026-05-22T18:27:57+00:00

Today I wrote a program using an array/list with 64000000 entries. However, when writing

  • 0

Today I wrote a program using an array/list with 64000000 entries. However, when writing sigma=[1]*64000000 using Python it runs fine, but later on, as the program computes, my Ubuntu freezes – without any reaction to inputs, not even mouse movement. I tried twice and the results are the same.

When implemented in C++, long long sigma[64000000] holds up fine and runs very fast.

Is there any reason that my program would freeze in the middle of running, other than crashes at beginning?

EDIT: To reply to Chris below, my code did not freeze until a couple of loops later.

Thank you all!

For those who interested in seeing the code, this is the program, a brute-force Project Euler 211:

def e211():
ans=0
sigma=[1]*64000000
for i in range(2,64000000):
    j=i;
    if ((j%1000==0) or (j<100)):
        print(j)
    q=i*i
    while j<64000000:
        sigma[j]+=q
        j+=i
for i in range(1,64000000):
    j=int(sqrt(sigma[i]))
    if j*j==sigma[i]:
        ans+=i
if __name__=='__main__':
    print(e211())
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:27:57+00:00Added an answer on May 22, 2026 at 6:27 pm

    Python lists are lists of objects. A number in Python is an object in itself, and takes up somewhat more storage than the 64 bits needed to represent a long long in C++. In particular, Python transparently handles numbers larger than 32 bits, which end up taking a lot more space than a simple integer.

    You may be find the standard Python array module useful. It provides Python-compatible access to uniform arrays of integers of specified size. (However, I note that it doesn’t offer a 64-bit integer type.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote this simple program today, but I found that cin.get() refuses to work
Today I wrote a small predicate to find matching symbols in a container. But
Ok, I wrote this question up earlier today but I decided to delete it
I wrote this small program today and I was blown away by the results.
I wrote this code: <? $text='how are you [b] today [/b]'; $patterns = array();
I wrote a code using jQuery plugin fullcalendar, and everything worked just fine, until
Today, I ran into this weird problem with a user using Mac OS X.
I was working on a program today and hit this strange bug. I had
I often use the excellent find program in Bash to list files with certain
I am new to Python and currently have to write a python program/script to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.