# Every Nth Char in Source Outputs N [duplicate]

Heavily inspired by Hello, World! (Every other character)

Write a program that outputs 1. When the first, third, fifth, etc. chars are removed, it outputs 2. When all chars where their (1-based) index in the source, mod N, are not 0, are removed, it should output N.

This is . The winner is the program that works with the largest N, while working for all n < N (obviously, to run up to N, it has to be at least N characters long). If there is a tie, the winner is the shortest answer that reaches the largest N. Your program must at least work up to N=2, since I don't think any languages will struggle with simply printing 1. To prevent programs extending infinitely, your program may not be longer than 1024 bytes.

# Example

Examples are based off of this sample program: abc123def456ghi789.

For the program to work for N=1, abc123def456ghi789 should output 1.

For the program to work for N=2, b13e46h79 should output 2.

For the program to work for N=3, c3f6i9 should output 3.

For the program to work for N=4, 1e67 should output 4.

For the program to work for N=5, 24i should output 5.

For the program to work for N=6, 369 should output 6.

For the program to work for N=7, dh should output 7.

etc.

The highest N this program could work for is its length, 18.

Remember that the winner will be the question that works for the largest N that also works for all smaller ns where n<N.

This is not a duplicate of Run the Nth characters to get N. That challenge take the first char and the each Nth char after that, while mine takes the Nth char and each Nth char after that. In addition, that is , and only is for N <= 16

## marked as duplicate by caird coinheringaahing, Toto, Sriotchilism O'Zaic, Downgoat, betsegJul 1 '17 at 14:08

• Very closely related. (Same challenge as code golf with fixed N.) – Martin Ender Jul 1 '17 at 12:16
• Is there any reason to assume that scoring by N doesn't just turn this into an exercise in patience for who can be bothered to add the most numbers? I don't see any natural upper limit. – Martin Ender Jul 1 '17 at 12:17
• @cairdcoinheringaahing as I already said, it's not. That challenge take the first char and the each Nth char after that, while mine takes the Nth char and each Nth char after that. In addition, that is code-golf, and only is for N <= 16 – Stephen Jul 1 '17 at 12:26