cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-5 of 5 results.

A358056 Given a row of n payphones (or phone booths), all initially unused, how many ways are there for n people to choose the payphones, assuming each always chooses one of the most distant payphones from those in use already? We consider here only the distance to the closest neighbor (in contrast to A095236).

Original entry on oeis.org

1, 1, 2, 4, 8, 20, 48, 216, 576, 1392, 7200, 43200, 184320, 1065600, 4314240, 21611520, 150958080, 573834240, 2293401600, 32107622400, 236017152000, 2798762803200, 22493915136000, 189837914112000, 1165284436377600, 13260174468710400, 148874616963072000
Offset: 0

Views

Author

Thomas Scheuerle, Oct 28 2022

Keywords

Comments

More precisely: The first person chooses any payphone. Thereafter, we assign each unused place a distance metric. All places with one or two direct neighbors get the metric 1, all places where the closest neighbor is one place away get 2 and so forth. Each person chooses a place from the set of places with the greatest metric assigned.
Each person continues to use his payphone until all are in use.

Examples

			a(5) = 20 because:  (x = free, o = occupied).
We start with 5 free places:
  xxxxx
Each position may be occupied in the next step:
  xxxxx-+--oxxxx
        |
        +--xoxxx
        |
        +--xxoxx
        |
        +--xxxox
        |
        +--xxxxo
In the next step we do not have any choice for four out of five cases, but for the case where the central position was occupied first we have two possibilities for the next step:
  xxxxx-+--oxxxx----oxxxo
        |
        +--xoxxx----xoxxo
        |
        +--xxoxx-+--oxoxx
        |        |
        |        ---xxoxo
        |
        +--xxxox----oxxox
        |
        +--xxxxo----oxxxo
In the next step we have only one choice in the cases where only the outer positions are occupied, we also have only one choice in the two central cases, and in all other cases each free position is a direct neighbor to an already occupied position and therefore equally possible.
  xxxxx-+--oxxxx----oxxxo----oxoxo- two possibilities ( 2! )
        |
        +--xoxxx----xoxxo- six possibilities ( 3! )
        |
        +--xxoxx-+--oxoxx----oxoxo- two possibilities ( 2! )
        |        |
        |        ---xxoxo----oxoxo- two possibilities ( 2! )
        |
        +--xxxox----oxxox- six possibilities ( 3! )
        |
        +--xxxxo----oxxxo----oxoxo- two possibilities ( 2! )
Thus a(5) = 4*2! + 2*3! = 20.
		

Crossrefs

Programs

  • MATLAB
    function a = A358056( max_n )
        a = 1;
        for n = 2:max_n
            k = 0;
            for m = 1:floor(n/2) % results are symmetrical calculate once *2
                k = k + 2*calcinitialchoice(n,m);
            end
            if mod(n,2) == 1 % case for central phone
                k = k + calcinitialchoice(n,m+1);
            end
            a(n) = k;
        end
    end
    function k = calcinitialchoice(len,pos)
        k = 1;
        s = abs([1:len]-pos); % init vector with metrics
        while max(s) > 1  % run until each unused phone has one used neighbor
            j = find(s == max(s)); d = find(diff(j)==1);
            k = k*2^length(d); % special case two neighbors with same metric
            j(d) = []; l = length(j);
            k = k*factorial(l); % permutation over cases with highest metric
              % update metrics
            s = min([s;abs(repmat([1:len],l,1)-repmat(j',1,len))],[],1);
        end
        k = k*factorial(length(find(s == 1))); % permutation over last unused places
    end

Formula

For convenience will we use here some special symbols in this formula section. We will use operations from the tropical semiring:
(+) -> min(b, c), (*) -> b+c, (/) -> b-c, (^) -> b*c.
Let's define the tropical polynomials P(x, m, k, n):
For k = 0: P(x, m, 0, n) = (x(^)2(/)m (+) m)(/)x.
For k > 0: We find M = min_{x = 1..n} P(x,m,k-1,n), then we find the set x = {X_1, ..., X_n} such that P(x,m,k-1,n) = M. If our set contains any pairs such that X_b = 1 + X_c then eliminate X_b from our set. Now we are ready to define the polynomial for k > 0:
P(x, m, k, n) = 1(/)( 1(/)P(x, m, k-1, n) (+) x(/)(x(^)2(/)X_1 (+) X_1) (+) .. (+) x(/)(x(^)2(/)X_n (+) X_n) ).
StartCase(m, n) = EqM(P(x ,m, 0, n))!*2^EqdM(P(x, m, 0, n))*EqM(P(x, m, 1, n))!*2^EqdM(P(x, m, 1, n))* ... *EqM(P(x, m, kmax, n))!*2^EqdM(P(x, m, kmax, n)), kmax is the greatest k where P(x,m,k,n) may evaluate to nonzero values for x in the range 1 to n.
EqM counts all x in the range 1 to n where P(x, m, k, n) evaluates to the overall minimum in this range of x, but we exclude from our count all solutions x where x-1 is a solution too.
EqdM counts all x in the range 1 to n where P(x, m, k, n) evaluates to the overall minimum in this range of x and P(x+1, m, k, n) evaluates to the same value.
a(n) = Sum_{m = 1..n} StartCase(m, n), m is the selection of the first phone in usage.
StartCase(m+b, n) = StartCase(n-b, n), for b = 0..floor(n/2).
StartCase(n, 2*n) = (1/2)*StartCase(1, 2*n), for n > 2.
StartCase(n, 2*n+1) = 2*StartCase(1, 2*n), for n > 1.
a(n) = floor(n/2)! * Combinations if only floor((n+1)/2) phone users arrive.
a(n) = Sum_{i=1..n} (b(i,1) + b(n+1-i,1))! * Product_{j=2..n-1} 2^(d(i,j) + d(n+1-i,j)) * (b(i,j) + b(n+1-i,j))! (See A095236 for definition and calculation of b(p,k) and d(p,k)). - Simon Wundling, May 21 2023

A361294 A variant of payphone permutations: given a circular booth with n payphones, one of which is already occupied, a(n) is the number ways for n-1 people to choose the payphones in order, where each person chooses an unoccupied payphone such that the closest occupied payphone is as distant as possible, and a payphone adjacent to a single occupied payphone is preferred over a payphone sandwiched between two occupied payphones.

Original entry on oeis.org

1, 1, 2, 2, 8, 16, 24, 48, 192, 1536, 4608, 18432, 23040, 92160, 241920, 1935360, 3870720, 41287680, 371589120, 11890851840, 29727129600, 237817036800, 1248539443200, 19976631091200, 11236854988800, 42807066624000, 176579149824000, 3390319676620800, 6886586843136000
Offset: 1

Views

Author

Max Alekseyev, Apr 10 2023

Keywords

Comments

Provides the same counts as A095239, but up to a choice for the first payphone.

Crossrefs

Formula

a(n) = A095239(n) / n = A095240(n+1) / 2.

A361295 A variant of payphone permutations: given a row of n payphones, a(n) is the number ways for n people to choose the payphones in order, where each person chooses an unoccupied payphone such that the closest occupied payphone is as distant as possible, and among the available payphones adjacent to a single occupied payphone the most preferred are payphones at open ends.

Original entry on oeis.org

1, 2, 4, 6, 12, 40, 144, 384, 1008, 6816, 33600, 115200, 783360, 3024000, 16450560, 140636160, 558351360, 2262435840, 29599395840, 180278784000, 2124328550400, 13664957644800, 127667338444800, 852837440716800, 11377123378790400, 116737211695104000, 816490952589312000
Offset: 1

Views

Author

Max Alekseyev, Apr 08 2023

Keywords

Crossrefs

Extensions

Definition corrected by Max Alekseyev, Jun 21 2023

A361296 A variant of payphone permutations: given a circular booth with n payphones, a(n) is the number ways for n people to choose the payphones in order, where each person chooses an unoccupied payphone such that the closest occupied payphone is as distant as possible.

Original entry on oeis.org

1, 2, 6, 8, 60, 144, 336, 384, 8640, 57600, 221760, 967680, 4193280, 9031680, 14515200, 30965760, 2368880640, 50164531200, 582465945600, 7357464576000, 50214695731200, 245494068019200, 1443672502272000, 24103053950976000, 200858782924800000, 835572536967168000
Offset: 1

Views

Author

Max Alekseyev, Apr 08 2023

Keywords

Crossrefs

A363785 A variant of payphone permutations: given a row of n payphones, a(n) is the number ways for n people to choose the payphones in order, where each person chooses an unoccupied payphone such that the closest occupied payphone is as distant as possible, and a payphone adjacent to a single occupied payphone is preferred over a payphone sandwiched between two occupied payphones.

Original entry on oeis.org

1, 2, 4, 6, 16, 28, 120, 264, 576, 2784, 11040, 37440, 204672, 679680, 2511360, 15655680, 52945920, 232796160, 2456801280, 11867627520, 97875025920, 576737280000, 4012233523200, 20013325516800, 215802239385600, 1778700504268800, 9687506721177600, 88613303353344000, 448250987623219200
Offset: 1

Views

Author

Max Alekseyev, Jun 21 2023

Keywords

Crossrefs

Showing 1-5 of 5 results.