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 7439517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:43:03+00:00 2026-05-29T10:43:03+00:00

Regular numbers are numbers that evenly divide powers of 60. As an example, 60

  • 0

Regular numbers are numbers that evenly divide powers of 60. As an example, 602 = 3600 = 48 × 75, so both 48 and 75 are divisors of a power of 60. Thus, they are also regular numbers.

This is an extension of rounding up to the next power of two.

I have an integer value N which may contain large prime factors and I want to round it up to a number composed of only small prime factors (2, 3 and 5)

Examples:

  • f(18) == 18 == 21 * 32
  • f(19) == 20 == 22 * 51
  • f(257) == 270 == 21 * 33 * 51

What would be an efficient way to find the smallest number satisfying this requirement?

The values involved may be large, so I would like to avoid enumerating all regular numbers starting from 1 or maintaining an array of all possible values.

  • 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-29T10:43:04+00:00Added an answer on May 29, 2026 at 10:43 am

    Okay, hopefully third time’s a charm here. A recursive, branching algorithm for an initial input of p, where N is the number being ‘built’ within each thread. NB 3a-c here are launched as separate threads or otherwise done (quasi-)asynchronously.

    1. Calculate the next-largest power of 2 after p, call this R. N = p.

    2. Is N > R? Quit this thread. Is p composed of only small prime factors? You’re done. Otherwise, go to step 3.

    3. After any of 3a-c, go to step 4.

      a) Round p up to the nearest multiple of 2. This number can be expressed as m * 2.
      b) Round p up to the nearest multiple of 3. This number can be expressed as m * 3.
      c) Round p up to the nearest multiple of 5. This number can be expressed as m * 5.

    4. Go to step 2, with p = m.

    I’ve omitted the bookkeeping to do regarding keeping track of N but that’s fairly straightforward I take it.

    Edit: Forgot 6, thanks ypercube.

    Edit 2: Had this up to 30, (5, 6, 10, 15, 30) realized that was unnecessary, took that out.

    Edit 3: (The last one I promise!) Added the power-of-30 check, which helps prevent this algorithm from eating up all your RAM.

    Edit 4: Changed power-of-30 to power-of-2, per finnw’s observation.

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

Sidebar

Related Questions

I want a regular expression that validate a string that allow only numbers and
Regular Expressions are usually expressed as strings, but they also have properties (ie. single
Hi ive got this regular expression and that extracts numbers from a string string.Join(null,System.Text.RegularExpressions.Regex.Split(expr,
How to write a regular expression that will pass a numbers from 60 to
I need help writing regular experssion that will match phone numbers in some data.
How do I create a regular expression that detects hexadecimal numbers in a text?
I have some large HEX values that I want to display as regular numbers,
Can anyone help me create a regular expression that accepts alphanumeric (numbers and letters
Trying to create a simple regular expression that can extract numbers(between 7 - 14)
I had some code that worked fine removing punctuation/numbers using regular expressions in python,

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.