# 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

• Sandbox Commented Jul 1, 2017 at 12:07
• Very closely related. (Same challenge as code golf with fixed N.) Commented Jul 1, 2017 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. Commented Jul 1, 2017 at 12:17
• @MartinEnder that challenge also always starts with the first character. Personally, I doubt that someone can go near infinite with it - I personally can't see any way you'd implement this infinitely. That's partly because of the difference in which chars get removed from my challenge and Helka's. If the answers prove me wrong I may need to set a byte cap or something. Thanks for the input. Commented Jul 1, 2017 at 12:20
• @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 Commented Jul 1, 2017 at 12:26