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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:34:39+00:00 2026-05-12T08:34:39+00:00

I am doing another Project Euler problem and I need to find when the

  • 0

I am doing another Project Euler problem and I need to find when the result of these 3 lists is equal (we are given 40755 as the first time they are equal, I need to find the next:

hexag n = [ n*(2*n-1)   | n <- [40755..]] 
penta n = [ n*(3*n-1)/2 | n <- [40755..]] 
trian n = [ n*(n+1)/2   | n <- [40755..]] 

I tried adding in the other lists as predicates of the first list, but that didn’t work:

hexag n = [ n*(2*n-1)   | n <- [40755..], penta n == n, trian n == n] 

I am stuck as to where to to go from here.

I tried graphing the function and even calculus but to no avail, so I must resort to a Haskell solution.

  • 1 1 Answer
  • 1 View
  • 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-12T08:34:40+00:00Added an answer on May 12, 2026 at 8:34 am
    • Your functions are weird. They get n and then ignore it?
    • You also have a confusion between function’s inputs and outputs. The 40755th hexagonal number is 3321899295, not 40755.

    If you really want a spoiler to the problem (but doesn’t that miss the point?):

    binarySearch :: Integral a => (a -> Bool) -> a -> a -> a
    binarySearch func low high
      | low == high = low
      | func mid = search low mid
      | otherwise = search (mid + 1) high
      where
        search = binarySearch func
        mid = (low+high) `div` 2
    
    infiniteBinarySearch :: Integral a => (a -> Bool) -> a
    infiniteBinarySearch func =
      binarySearch func ((lim+1) `div` 2) lim
      where
        lim = head . filter func . lims $ 0
        lims x = x:lims (2*x+1)
    
    inIncreasingSerie :: (Ord a, Integral i) => (i -> a) -> a -> Bool
    inIncreasingSerie func val =
      val == func (infiniteBinarySearch ((>= val) . func))
    
    figureNum :: Integer -> Integer -> Integer
    figureNum shape index = (index*((shape-2)*index+4-shape)) `div` 2
    
    main :: IO ()
    main =
      print . head . filter r $ map (figureNum 6) [144..]
      where
        r x = inIncreasingSerie (figureNum 5) x && inIncreasingSerie (figureNum 3) x
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 229k
  • Answers 229k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I had problems with this and Naughter's free XTaskDialog API,… May 13, 2026 at 1:52 am
  • Editorial Team
    Editorial Team added an answer At some point you should invalidate the timer. You'll need… May 13, 2026 at 1:52 am
  • Editorial Team
    Editorial Team added an answer You cannot do it this. Check out the serie of… May 13, 2026 at 1:52 am

Related Questions

I am doing yet another Project Euler problem - Problem 38 . I have
I have a pretty big webapp that's being built in MVC. I'm also abstracting
I have code in the top layer of my .Net web application that I'd
Everything works fine when the unit tests class is part of the main project

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.