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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:14:46+00:00 2026-06-07T06:14:46+00:00

I am trying to find some special numbers such that when it is divided

  • 0

I am trying to find some special numbers such that when it is divided by 2 gives 1, divided by 3 gives 2 and so on upto 6.

This perfectly works.

[ x | x <- [1..1000],x `mod` 2 == 1 , x `mod` 3 == 2 , x `mod` 4 == 3 , x `mod` 5 == 4 , x `mod` 6 == 5]

Ans:

[59,119,179,239,299,359,419,479,539,599,659,719,779,839,899,959]

I am trying to make it better so that it is not too verbose but the following doesn’t work.

[ x | x <- [1..1000], y <- [2..6], x `mod` y == (y-1) ]

It takes all x for which any of the y satisfies the condition but what I want is, I want x which satisfies the condition for all y.

  • 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-07T06:14:48+00:00Added an answer on June 7, 2026 at 6:14 am

    You can write the condition as

    [ x | x <- [1..1000], all (\y -> x `mod` y == y-1) [2 .. 6]]
    

    But you can do better in this specific case,

    let modulus = foldl1 lcm [2 .. 6]
    [x | x <- [1 .. 1000], x `mod` modulus == modulus - 1]
    [modulus - 1, 2*modulus - 1 .. 1000]  -- even better
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am trying to find some text only if it contains english letters and numbers
I have been trying to find some resource on this topic for a while
I've been trying to find some manual information on this, but my search is
I'm trying to find some easy to understand and use tutorials for D3 that
Im trying to find some sample code that shows how use the WMI (
I have been trying to find some step by step guidance on how to
I'm trying to find some information on preferred solution setup when using MVC 2
I’m trying to find some objective comparisons of Captaris and K2 workflow products. I
I am trying to find some float number (like -1234.5678) in a huge text
I am trying to find some code which will help me to find out

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.