Unique carbons on long carbon chains
In general, the problem is a mathematical one. What you are asking for is the 'equivalence classes' of the atoms under the symmetry group. As pointed out in the comments, this may or may not be chemically important.

One simple way to divide the atoms into equivalence classes is to use Morgan numbers. The algorithm is particularly simple:


Label the atoms with their degree (so terminal carbons are "1")
Update each atom's label by adding the labels of the neighbouring atoms
Repeat until the number of different labels is constant


So, for a linear hydrocarbon, the labels start out as [1, 2, 2, ..., 2, 1] and update to [3, 5, 6, 6, ..., 6, 5, 3]. After a couple more rounds, you get a pattern of labels like [a, b, c, d, d, c, b, a].

This works reasonably well, although there are more complex algorithms for determining non-equivalent atoms. As you have worked out, the atoms beyond the immediate neighbourhood are necessary.