This kata is inspired on the problem #50 of the Project Euler. 

The prime ``` 41```  is the result of the sum of many consecutive primes.

In fact, ``` 2 + 3 + 5 + 7 + 11 + 13 = 41 , (6 addens)   ``` 

Furthermore, the prime ``` 41```  is the prime below ``` 100 (val_max)```  that has the longest chain of consecutive prime addens.

The prime with longest chain of addens for ```val_max = 500``` is ```499``` with ```17``` addens. 

In fact:
```3+5+7+11+13+17+19+23+29+31+37+41+43+47+53+59+61= 499```

Find the function ```prime_maxlength_chain()```(primeMaxlengthChain() javascript), that receives an argument ```val_max```, the upper limit, all the found primes should be less than ```val_max``` and outputs this found prime.

Let's see some cases:
```python
prime_maxlength_chain(100) == [41]
prime_maxlength_chain(500) == [499]
```
If we have more than one prime with these features, the function should output an array with the found primes sorted.
```python
prime_maxlength_chain(499) == [379, 491]
```
Random Tests for `val_max` (`valMax`)
```
100 ≤ val_max ≤ 500.000
```
Enjoy it!

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

def _disabled_input(*args, **kwargs):
    raise RuntimeError("input() is disabled in callable mode")
builtins.input = _disabled_input

ns = {"__name__": "__judge__"}  # prevent if __name__ == "__main__" blocks
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'import numpy\ndef primesto(n):\n    """ Returns a array of primes, 3 <= p < n """\n    sieve = numpy.ones(n//2, dtype=numpy.bool)\n    for i in range(3,int(n**0.5)+1,2):\n        if sieve[i//2]:\n            sieve[i*i//2::i] = False\n    return [2]+list(2*numpy.nonzero(sieve)[0][1::]+1)\n\ndef cum_sum_500k():\n    return numpy.array([0]+primesto(500000)).cumsum()\n\ndef circular_list():\n    p = primesto(500000)\n    c = cum_sum_500k()\n    l=[]\n    s=1\n    for i in range(400):\n        for j in range(0,i-s+1):\n            x=c[i]-c[j]\n            #print(i,j,x)\n            if x in p:\n                if i-j > s: s = i-j\n                #l += [[x,i-j,[p[k] for k in range(j,i)]]]\n                l += [[x,i-j]]\n                #print((x,s,i))\n    l.sort()\n    return l\n#    print(p[i])\n\ndef prime_maxlength_chain(n):\n    if prime_maxlength_chain.cl == []:\n        prime_maxlength_chain.cl = circular_list()\n    cl=prime_maxlength_chain.cl\n    for i in range(len(cl)):\n        idx = 0\n        if cl[i][0] >= n:\n            idx = i-1\n            break\n    l = []\n    for i in range(idx,1,-1):\n        if cl[i][1] == cl[idx][1]: l += [cl[i][0]]\n        else: break\n    l.sort()\n    return l\n\n#If you want to generate the circular primes list use cl=[] below\n#prime_maxlength_chain.cl = []\nprime_maxlength_chain.cl = [\n[2, 1],[3, 1],[5, 2],[17, 4],[41, 6],[127, 9],[197, 12],[281, 14],[379, 15],[491, 15],[499, 17],[563, 17],[857, 19],[953, 21],[1151, 23],[1259, 25],[1361, 25],\n[1583, 27],[1823, 27],[2069, 27],[2099, 29],[2399, 31],[2417, 33],[2579, 35],[2897, 35],[2909, 37],[3803, 39],[3821, 41],[4217, 43],[4421, 43],[4651, 45],[4871, 45],[5107, 47],\n[5333, 47],[5813, 49],[6053, 49],[6079, 53],[6599, 55],[7699, 60],[8273, 61],[8893, 64],[9521, 65],[10181, 65],[10859, 65],[11597, 71],[12329, 71],[12713, 73],[13099, 75],[13877, 75],\n[14669, 75],[15527, 79],[16823, 81],[18131, 81],[19013, 81],[21407, 85],[22037, 95],[22039, 96],[24133, 100],[25237, 102],[28087, 103],[28099, 105],[28687, 105],[28697, 108],[31729, 111],[32353, 114],\n[33623, 115],[34913, 117],[36217, 117],[36871, 117],[37561, 122],[38921, 124],[41017, 125],[42451, 125],[42463, 127],[43201, 130],[44683, 132],[47711, 133],[49253, 133],[49279, 137],[52517, 141],[54167, 143],\n[55837, 146],[61027, 152],[64613, 155],[66463, 158],[70241, 162],[76099, 163],[78121, 165],[78139, 167],[79151, 167],[81203, 169],[84313, 171],[86453, 178],[92951, 183],[101999, 191],[102001, 192],[109147, 198],\n[115279, 201],[116531, 203],[116533, 204],[119069, 206],[121631, 208],[129419, 214],[132059, 216],[137477, 217],[138863, 219],[141671, 221],[147347, 221],[148817, 225],[153137, 225],[154579, 225],[157489, 225],[157561, 229],\n[157579, 231],[162007, 231],[163483, 231],[164963, 231],[164999, 233],[166541, 237],[171131, 239],[172687, 241],[175781, 241],[178889, 241],[182009, 241],[182099, 247],[182107, 249],[198197, 251],[199831, 251],[201599, 257],\n[203279, 259],[204979, 261],[210053, 261],[213461, 261],[213533, 267],[215261, 267],[218749, 269],[222269, 273],[225821, 273],[225829, 275],[240353, 279],[240371, 281],[240379, 283],[242243, 283],[244109, 283],[251609, 285],\n[255443, 291],[257353, 291],[263171, 296],[269069, 297],[281023, 299],[283079, 305],[287137, 308],[303643, 309],[303691, 313],[305783, 313],[310019, 317],[314267, 317],[318557, 321],[324991, 321],[325009, 323],[325019, 326],\n[329401, 328],[333821, 330],[338279, 332],[342761, 334],[351811, 335],[354097, 337],[356387, 339],[360977, 341],[360979, 342],[370261, 343],[372607, 345],[379667, 350],[393961, 356],[398771, 358],[408479, 359],[423257, 361],\n[423287, 363],[425819, 365],[428339, 365],[433421, 367],[433439, 369],[438521, 369],[441101, 373],[448859, 375],[448867, 377],[477809, 377],[478001, 387],[483377, 389],[496877, 391],[499607, 393]\n]\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

_target = None
_fn_name = 'prime_maxlength_chain'
if _fn_name:
    if "Solution" in ns:
        try:
            _obj = ns["Solution"]()
            if hasattr(_obj, _fn_name):
                _target = getattr(_obj, _fn_name)
        except Exception:
            _target = None
    if _target is None and _fn_name in ns and callable(ns[_fn_name]):
        _target = ns[_fn_name]
# Fallback: if there's exactly one user-defined function, use it
if _target is None:
    _cands = [v for k, v in ns.items() if callable(v) and getattr(v, "__module__", "") in ("__judge__", "__main__")]
    _user_funcs = [c for c in _cands if getattr(c, "__name__", "").startswith("_") is False]
    if len(_user_funcs) == 1:
        _target = _user_funcs[0]
if _target is None:
    raise RuntimeError(f"Could not resolve callable '{_fn_name}'")

_raw = sys.stdin.read().strip()
if _raw:
    _parsed = json.loads(_raw)
    if isinstance(_parsed, dict):
        _kwargs = _parsed.get("kwargs", {})
        _args = _parsed.get("args", [])
    else:
        _args, _kwargs = _parsed, {}
else:
    _args, _kwargs = [], {}
if not isinstance(_args, (list, tuple)):
    _args = [_args]
_res = _target(*_args, **_kwargs)
try:
    sys.stdout.write(repr(_res) + "\n")
except Exception:
    pass

```

Measured memory_bytes: 5740