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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:18:01+00:00 2026-05-15T02:18:01+00:00

Guidelines for code-golf on SO We’ve all seen phone numbers that are put into

  • 0

Guidelines for code-golf on SO

We’ve all seen phone numbers that are put into words: 1-800-BUY-MORE, etc.

What is the shortest amount of code you can write that will produce all the possible combinations of words for a 7 digit US phone number.

Input will be a seven-digit integer (or string, if that is simpler), and assume that the input is properly formed.

Output will be a list of seven-character strings that

For instance, the number 428-5246 would produce

GATJAGM
GATJAGN
GATJAGO
GATJAHM
GATJAHN
GATJAGO
GATJAIM
GATJAIN
GATJAIO
and so on…..

Winning criterion will be code from any language with the fewest characters that produces every possible letter combination.

Additional Notes:

  • To make it more interesting, words
    can be formed only by using the
    letters on a North American Classic
    Key Pad
    phone with three letters
    per number as defined here.That means that Z and Q are excluded.
  • For the number ‘1’, put a space.
  • For the number ‘0’, put a hyphen ‘-‘

Bonus points awarded for recognizing output as real English words. Okay, not really. 😉

Added: Okay, lets go with “Nick’s Modified North American Classic Key Pad” which has an ‘O’ (oh, not zero) on the 6 key.

  • 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-15T02:18:01+00:00Added an answer on May 15, 2026 at 2:18 am

    q, 52 39 chars

    (cross/)(3 cut"--- ",.Q.A except"QZ")

    q is evaluated left of right.

    .Q.A contains the vector “ABC…XYZ”

    except returns x excluding values in y

    join “— ” to the modified char vector

    cut into chunks of 3

    cross returns all possible combinations, and is applied across all chunks

    q)(cross/)(3 cut"---   ",.Q.A except"QZ")[4 2 8 5 2 4 6] 
    "GATJAGM"
    "GATJAGN"
    "GATJAGO"
    "GATJAHM"
    "GATJAHN"
    "GATJAHO"
    "GATJAIM"
    "GATJAIN"
    "GATJAIO"
    ....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.