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

  • SEARCH
  • Home
  • 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 7789097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:11:35+00:00 2026-06-01T21:11:35+00:00

Take the following problem: how many numbers are in a given range of integers,

  • 0

Take the following problem: “how many numbers are in a given range of integers, from which both their sum of digits and the sum of its square are prime?”

I was watching around codereview, and here I found an interesting question and tried to solve it.

So one can check prime numbers in a ordinary fashion, i.e. using a for loop from 2 to i and check for divisibility.

The interesting thing is here. BlueRaja - Danny Pflughoeft suggests a trick: “Since you only need to sieve to the square root of the number you’re testing for primality, you only need to run your sieve from 3 to*sqrt(⌈log10(B)⌉*81)“.

I have a question regarding implementation of Sieve of Eratosthenes.
what is the size of boolean array, which contains numbers to process for sieve.? can somebody write a code or any hint?

  • 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-06-01T21:11:37+00:00Added an answer on June 1, 2026 at 9:11 pm

    Here’s an example of the implementation of the Sieve of Eratosthenes using Java: link.

    For the second part of your questions see this link:

    “The maximum sum of squares-of-digits of an n-digit number is n*9*9 = n*81. The number of digits in a number B is ⌈log10(B)⌉. Since you only need to sieve to the square root of the number you’re testing for primality, you only need to run your sieve from 3 to sqrt(⌈log10(B)⌉*81). Even for B = 1 billion, this means the max you need to sieve to is 28.”

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

Sidebar

Related Questions

Okay so i have a semi weridish problem with re.sub. Take the following code:
Following on from my previous question [link text][1] , I have a new problem.
Take this following code from an example HR system. The user has the ability
I currently have an ActiveX control which links in many c/c++ dlls. The problem
I have a following problem. I have some items in my treeview which are
My Scenario I'm working on a database which will contain many details from various
I have to solve a following problem. there are many files let's say 3
Take the following method (written in Ruby but this question could be applied to
Take the following naive implementation of a nested async loop using the ThreadPool: ThreadPool.SetMaxThreads(10,
Take the following example, I have a class public class SomeItem { public string

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.