3 added 123 characters in body
source | link

Java, 96 8080 76 bytes

n->{int i=0,ji,v=0,l[]=newm[]=new int[n];for(;++i<n;l[v]=i;--n>0;m[v]=n,v=j<1v=i<1?0:i-jn)j=l[v];returni=m[v];return v;}

Not obfuscated:

intFunction<Integer, Integer> vanEck(int =
n) -> {

    int[]int lastPositionsi; = new int[n];               // i is the value of n when v was previously encountered
    int indexv = 0;              // v is the current element of vanEck sequence
    intint[] valuem = 0;
new int[n];   int// lastPosition;m[v] is the value of n when v was previously encountered

    while (++index--n <> n0) {       // n is used as a decrementing counter

        lastPositioni = lastPositions[value];m[v];
        lastPositions[value]m[v] = index;n;
        valuev = lastPositioni == 0 ? 0 : indexi - lastPosition;n;
    }

    return value;v;
};

Java, 96 80 bytes

n->{int i=0,j,v=0,l[]=new int[n];for(;++i<n;l[v]=i,v=j<1?0:i-j)j=l[v];return v;}

Not obfuscated:

int vanEck(int n) {

    int[] lastPositions = new int[n];
    int index = 0;
    int value = 0;
    int lastPosition;

    while (++index < n) {

        lastPosition = lastPositions[value];
        lastPositions[value] = index;
        value = lastPosition == 0 ? 0 : index - lastPosition;
    }

    return value;
}

Java, 96 80 76 bytes

n->{int i,v=0,m[]=new int[n];for(;--n>0;m[v]=n,v=i<1?0:i-n)i=m[v];return v;}

Not obfuscated:

Function<Integer, Integer> vanEck =
n -> {

    int i;                  // i is the value of n when v was previously encountered
    int v = 0;              // v is the current element of vanEck sequence
    int[] m = new int[n];   // m[v] is the value of n when v was previously encountered

    while (--n > 0) {       // n is used as a decrementing counter

        i = m[v];
        m[v] = n;
        v = i == 0 ? 0 : i - n;
    }

    return v;
};
2 Thanks to comments, java proposition now uses lambda, 'for' loop, declares int[] with other int and <1 test instead of ==0.
source | link

Java, 9696 80 bytes

int f(int n)->{int[]l=new int[n];intint i=0,j,v=0;whilev=0,l[]=new int[n];for(++i<n){j=l[v];l[v]=i;v=j==0;++i<n;l[v]=i,v=j<1?0:i-j;}returnj)j=l[v];return v;}

Not obfuscated:

int vanEck(int n) {

    int[] lastPositions = new int[n];
    int index = 0;
    int value = 0;
    int lastPosition;

    while (++index < n) {

        lastPosition = lastPositions[value];
        lastPositions[value] = index;
        value = lastPosition == 0 ? 0 : index - lastPosition;
    }

    return value;
}

Java, 96 bytes

int f(int n){int[]l=new int[n];int i=0,j,v=0;while(++i<n){j=l[v];l[v]=i;v=j==0?0:i-j;}return v;}

Not obfuscated:

int vanEck(int n) {

    int[] lastPositions = new int[n];
    int index = 0;
    int value = 0;
    int lastPosition;

    while (++index < n) {

        lastPosition = lastPositions[value];
        lastPositions[value] = index;
        value = lastPosition == 0 ? 0 : index - lastPosition;
    }

    return value;
}

Java, 96 80 bytes

n->{int i=0,j,v=0,l[]=new int[n];for(;++i<n;l[v]=i,v=j<1?0:i-j)j=l[v];return v;}

Not obfuscated:

int vanEck(int n) {

    int[] lastPositions = new int[n];
    int index = 0;
    int value = 0;
    int lastPosition;

    while (++index < n) {

        lastPosition = lastPositions[value];
        lastPositions[value] = index;
        value = lastPosition == 0 ? 0 : index - lastPosition;
    }

    return value;
}
1
source | link

Java, 96 bytes

int f(int n){int[]l=new int[n];int i=0,j,v=0;while(++i<n){j=l[v];l[v]=i;v=j==0?0:i-j;}return v;}

Not obfuscated:

int vanEck(int n) {

    int[] lastPositions = new int[n];
    int index = 0;
    int value = 0;
    int lastPosition;

    while (++index < n) {

        lastPosition = lastPositions[value];
        lastPositions[value] = index;
        value = lastPosition == 0 ? 0 : index - lastPosition;
    }

    return value;
}