Problem 414 - Discussion Forum
Spoiler free discussion here!!

Remind me
Go to problem
Take the number 134431001 as an example. We can make pairs using the 2 digits following one another:
[(1, 3), (3, 4), (4, 4), (4, 3), (3, 1), (1, 0), (0, 0), (0, 1)]

If we assume that these are the lattice points, we can draw line segments in the same order and we can have a polygon.

In general for a k-digit number like we can have a (k-1)-gon:
[(d1,d2), (d2,d3), ..., (dk-1,dk)]

If the drawn polygon is a convex one then we will call this kind of number as convex number.

How many positive convex numbers are there?

Answer format: count,sum

[My timing: < 1m]

- Any two neighbouring line segments cannot be collinear.
- All the generated pairs must be distinct.
- Some polygons can be generated by more than one number. 
  For example: 112321, 123211, 232112, 321123, 211232
  Since the numbers are different, they are all counted.

sinan - 1w:3d ago

I tried to specify it with the following:

"In general for a k-digit number we can have a (k-1)-gon"

So for 2 or 3 digits numbers we cannot have a polygon. The numbers should at least have 4 digits.

lesnik7 - 1w:3d ago

Just to clarify: any 2 or 3 digit numbers are not convex, as they do not generate a polygon? Im not sure, because such numbers satisfy the conditions titled "notes"?

sinan - 2w:1d ago


It's not necessary. For example 1122 corresponds to the following points:

(1,1) (1,2) (2,2)

2311 is also valid:

(2,3) (3,1) (1,1)

Looks like if d1=dk then more than one number can generate the same polygon.


C_K_Yang - 2w:1d ago

Is it necessary that d1 is equal to dk for a k-digit convex number?

In your example, d1 is always equal to dk

Is 2311 a valid convex number? (d1 != d4)

sinan - 2w:3d ago

Yes those are all. There are 5 points and you can start from any of those hence 5 different numbers.

But since leading zeroes not allowed there may less in some cases where a zero digit is present in the number.

nielkh - 2w:3d ago

How many and which numbers generate the polygon with vertices:


The wording suggests:

112321, 123211, 232112, 321123, 211232.

Are those all?


sinan - 2w:5d ago

No, they aren't. First digit is not zero.

liuguangxi - 2w:5d ago


For positive convex number, whether leading zeros are permitted (e.g. 0011)?


Time may end, but hope will last forever.

Other Challenge Sites