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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:18:35+00:00 2026-05-30T20:18:35+00:00

I want to pick a random number and express that number in the format

  • 0

I want to pick a random number and express that number in the format of a lottery system. For example, a lottery system has 7 groups of 2-digit numbers from 01 to 40 with the total possible combinations of 163,840,000,000 (40 to the 7th power). If I pick a random base-10 number, say 453,867,221, How can I express that in 7 groups of 2-digit numbers from 01-40?

My programming language of choice is Python, although any language/pseudo language will help.

  • 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-30T20:18:36+00:00Added an answer on May 30, 2026 at 8:18 pm

    So you have 40-base numbers with 7 40-base “digits”. Converting them to an integer is relatively simple (I’m using explicit loops to make things clearer):

    digits = [12, 5, 39, 1, 40, 8, 17]
    total = 0
    for digit in digits:
        total = total * 40 + (digit-1)
    

    Converting back is just the reverse:

    total = ...
    digits = []
    while total > 0:
        digits = [(total % 40 + 1)] + digits
        total = total / 40
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to generate eight bit (uint8_t) random numbers so that I exclude a
In my app, I want to pick a random image. Each image that I
I am trying to make a script to pick random number between two numbers
I have array of countries. I want to pick 5 random countries from my
I want to generate a random password that has the following pattern: Capital, small,
Could someone tell me how can I pick several different random numbers from an
I want to pick random number of inputs randomly in an array of input
I have a model in Rails from which I want to pick a random
Suppose one has a table of 1000 entries. We want to pick a random
I have a table that I want to pick one row from it and

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.