cp-library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub kobejean/cp-library

:warning: cp_library/math/series/mod/arthsum_fn.py

Code

import cp_library.math.series.__header__

def arthsum(d, a, n, mod):
    return (((n-1)*d+(a<<1)) % mod * n >> 1) % mod
'''
╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸
             https://kobejean.github.io/cp-library               
'''

def arthsum(d, a, n, mod):
    return (((n-1)*d+(a<<1)) % mod * n >> 1) % mod
Back to top page