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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:07:21+00:00 2026-05-23T11:07:21+00:00

My apologies if this is the wrong site for this problem, as it is

  • 0

My apologies if this is the wrong site for this problem, as it is more math-related than programming.

I am trying to write a series of 7 page links, in a Google-esque fashion. Essentially, it will be 7 numbers, s to (s + 6), where s is my starting value. I am having trouble calculating my starting value, given a limited amount of information.

In advance, I know the maximum value in the series, this is variable, but it is always greater than 7. In my formula-writing attempts, I have been calling this value g, so g > 7.

I also know the page number the user has selected. I have been calling this value p

So, for example, if g was 8, I would need to generate these series of numbers, where the bolded number is equal to p:

1 2 3 4 5 6 7

1 2 3 4 5 6 7

1 2 3 4 5 6 7

1 2 3 4 5 6 7

2 3 4 5 6 7 8

2 3 4 5 6 7 8

2 3 4 5 6 7 8

2 3 4 5 6 7 8

As long as I can determine the starting value using the information available, everything else falls into place. Can anyone advise on how I would calculate my starting value using the information available? If it is relevant, I will be writing this formula in PHP.

Thanks in advance for any input.

  • 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-23T11:07:21+00:00Added an answer on May 23, 2026 at 11:07 am

    This is just simulation code for testing.

    <?
    $g=16;
    for($p=1;$p<17;$p++){
    $start = $g-$p > 3 ? ($p-4<1?1:($p-4)) : $g-6;
        echo "$p :: ";
        for($i=$start;$i<$start+7;$i++){
            echo $i . " ";
        }
        echo "<br>";
    }
    ?>
    

    SO your Start Page is decided by (the thing you actually need):

    $start = $g-$p > 3 ? ($p-4<1?1:($p-4)) : $g-6;
    

    Output (Simulation for g=16, and p from 1 to 16)::

    p :: page numbers

    1 :: 1 2 3 4 5 6 7
    2 :: 1 2 3 4 5 6 7
    3 :: 1 2 3 4 5 6 7
    4 :: 1 2 3 4 5 6 7
    5 :: 1 2 3 4 5 6 7
    6 :: 2 3 4 5 6 7 8
    7 :: 3 4 5 6 7 8 9
    8 :: 4 5 6 7 8 9 10
    9 :: 5 6 7 8 9 10 11
    10 :: 6 7 8 9 10 11 12
    11 :: 7 8 9 10 11 12 13
    12 :: 8 9 10 11 12 13 14
    13 :: 10 11 12 13 14 15 16
    14 :: 10 11 12 13 14 15 16
    15 :: 10 11 12 13 14 15 16
    16 :: 10 11 12 13 14 15 16
    

    And simulation for g=8, p from 1 to 8

    1 :: 1 2 3 4 5 6 7
    2 :: 1 2 3 4 5 6 7
    3 :: 1 2 3 4 5 6 7
    4 :: 1 2 3 4 5 6 7
    5 :: 2 3 4 5 6 7 8
    6 :: 2 3 4 5 6 7 8
    7 :: 2 3 4 5 6 7 8
    8 :: 2 3 4 5 6 7 8
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apologies if I've got the terminology wrong here—I can't think what this particular idiom
Apologies if this is a dumb question but I'm trying to format a currency
Unsure if this should be on here or serverfault so apologies if I'm wrong.
apologies if this is redundant, I spent a good deal of time trying to
First off i'm new to Linux programming so apologies if this makes no sense
I need an help to understand this problem I am facing...and apologies if it
I apologise if this is on the wrong StackExchange site. I suppose it could
Apologies if this a newbish question, but I'm new to Mac programming, and thought
Apologies if this seems like I want my problem saved for me, but I
I come from more of an Android development background so apologies if this is

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.