I am working with a collection of cards. On each card is written a set of numbers $1\le n\le N$ in ascending order.
When I arrange the cards in lexicographic order on the table, no two adjacent cards share a number.
The cards are designed so that when I pick a number $r$, select all the cards containing $r$, and sum the smallest numbers on each of those cards, I get the total $r$.
The idea is that I can ask a friend to choose a number $1\le n\le N$, and ask them to identify the cards containing that number. From that information I can identify the number by doing a simple sum.
For example if $N=4$ the three sets $\{1,4\}, \{2\}$ and $\{3,4\}$ could be written on the cards. They are in lexicographic order, no adjacent cards share a number, and any number $1\le n\le 4$ can be identified.
If you choose $1$ for example, there is a single card lowest value $1$. With $4$ you pick up two cards values $1+3=4$
Given $N$ what is the smallest number of cards I need? Given the number of cards, what is the largest $N$ possible?
In fact any of the five numbers $0\le n\le 4$ can be identified from this set.
Solution: [to unedited question]
If n is odd then solution is (n+1)/2.
if n is even then solution is n/2+1.
But i am getting this is a wrong answer.Where i have made a mistake?
Note the problem appears here and seems to be popular mid August 2015
Do you mean like this:
With four cards the sets $\{1,4,6\}; \{2,7\}; \{3,4\}; \{5,6,7\}$ allow you to distinguish between the integers $1\le n \le 7$ (and you get zero as a bonus).
With five cards I get $\{1,4,6,9,12\}; \{2,7,10\}; \{3,4,11,12\}; \{5,6,7\};\{8,9,10,11,12\}$ which get me to $12$ - that seems better than you have done.
I think the pattern I can see in the lowest elements of these sets will continue - but I'll leave that for you to explore - that would give a different answer from the one you have.