Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Formula For a Series of Numbers (Mathy Problem)
    primarykey
    data
    text
    <p>My apologies if this is the wrong site for this problem, as it is more math-related than programming.</p> <p>I am trying to write a series of 7 page links, in a Google-esque fashion. Essentially, it will be 7 numbers, <strong><em>s</em></strong> to (<strong><em>s</em></strong> + 6), where <strong><em>s</em></strong> is my starting value. I am having trouble calculating my starting value, given a limited amount of information.</p> <p>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 <strong><em>g</em></strong>, so <strong><em>g</em></strong> > 7.</p> <p>I also know the page number the user has selected. I have been calling this value <strong><em>p</em></strong></p> <p>So, for example, if <strong><em>g</em></strong> was 8, I would need to generate these series of numbers, where the bolded number is equal to <strong><em>p</em></strong>:</p> <p><strong>1</strong> 2 3 4 5 6 7 </p> <p>1 <strong>2</strong> 3 4 5 6 7</p> <p>1 2 <strong>3</strong> 4 5 6 7</p> <p>1 2 3 <strong>4</strong> 5 6 7</p> <p>2 3 4 <strong>5</strong> 6 7 8</p> <p>2 3 4 5 <strong>6</strong> 7 8</p> <p>2 3 4 5 6 <strong>7</strong> 8</p> <p>2 3 4 5 6 7 <strong>8</strong></p> <p>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.</p> <p>Thanks in advance for any input.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload