Retired

How many symbols must be on one card? (retired)

6 of 19pfedan

Description:

Introduction

You want do design a card game with n cards where on each card are s different symbols. Each card c_i always has one symbol in common with any other card c_j with i != j.

It wouldn't be fun if the common symbol between any two cards is always the same.

Question

You wonder how many different symbols you have to put on one card, given that the game shall have n cards (with n > 3). Find the minimal number of symbols to use so that any 2 cards have exactly one symbol in common.

Example

In case of n = 7 cards, you would need 3 symbols on each card - consider the following matrix of cards and symbols:

              symbol
        1  2  3  4  5  6  7 
     1  X  X  -  -  X  -  -
     2  X  -  X  -  -  X  -
     3  X  -  -  X  -  -  X
card 4  -  -  X  X  X  -  -
     5  -  -  -  -  X  X  X
     6  -  X  X  -  -  -  X
     7  -  X  -  X  -  X  -

Notice that any card only has one symbol in common with any other card.

Bad example:

The general case of the trivial solution shall not be valid (example with n = 4 and s = 2):

      symbol
     1  2  3  4  5
c_1  X  X  -  -  -
c_2  X  -  X  -  -
c_3  X  -  -  X  -
c_4  X  -  -  -  X

This solution is prohibited, as the common symbol between any pair of cards is always the same.

Task

Write a function

CntDiffSymbols(n int)
cntDiffSymbols(n)
cntDiffSymbols(n: number)
cnt_diff_symbols(n)

that returns the count of different symbols needed for n cards.

Permutations
Mathematics
Algorithms

Stats:

CreatedAug 17, 2020
Warriors Trained414
Total Skips302
Total Code Submissions154
Total Times Completed19
Go Completions6
JavaScript Completions7
Python Completions14
TypeScript Completions2
Total Stars4
% of votes with a positive feedback rating60% of 10
Total "Very Satisfied" Votes3
Total "Somewhat Satisfied" Votes6
Total "Not Satisfied" Votes1
Total Rank Assessments9
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • pfedan Avatar
Ad