23
1
The task
In this challenge, your task is to write a program in a programming language L that takes a positive integer n, and outputs the sum of the proper divisors of n (sequence A001065 on OEIS). It should return the correct output for any 1 ≤ n ≤ 10 000. Here are the first 10 outputs:
0, 1, 1, 3, 1, 6, 1, 7, 4, 8
Furthermore, your program must be a fake polyglot, which means the following. It is a valid program in another programming language L', and for each input 1 ≤ n ≤ 10 (the test cases above), it returns the sum of proper divisors of n, but there exists some 11 ≤ n ≤ 10 000 for which it doesn't return the correct result. It may return something incorrect, loop forever, crash etc. It can give a wrong result for all n ≥ 11, for some of them or just one.
Rules and scoring
You can write a full program or a function, and you can have different means of input and output in the two languages. The lowest byte count wins. Standard code-golf rules apply. In this challenge, different major versions or implementations of a language are considered distinct.
Note that if you use programming languages with non-ASCII encodings (as many do on this site), the same sequence of bytes must be used for both languages. This means that you must either convert between potentially different code pages or suffer penalties for multi-byte Unicode characters.
Additional test cases
20 -> 22
36 -> 55
180 -> 366
997 -> 1
2875 -> 869
10000 -> 14211
1This is an acceptable solution. I'll clarify it in the main post. – Zgarb – 2017-08-01T15:01:17.140