Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This is definitely a bug, which is worth reporting. Meanwhile you can use a custom period computing function such as

def myperiod(S,mod):
    T = dict()
    k = 0
    while True:
        t = (S(k)%mod,S(k+1)%mod)
        if t in T:
            return k-T[t]
        T[t] = k
        k += 1

print( myperiod( BinaryRecurrenceSequence(3,2,u0=0,u1=1), 4 ) )

This is definitely a bug, which is worth reporting. I reported at https://github.com/sagemath/sage/issues/38112

Meanwhile you can use a custom (not efficient though) period computing function such as

def myperiod(S,mod):
    T = dict()
    k = 0
    while True:
        t = (S(k)%mod,S(k+1)%mod)
        if t in T:
            return k-T[t]
        T[t] = k
        k += 1

print( myperiod( BinaryRecurrenceSequence(3,2,u0=0,u1=1), 4 ) )

This is definitely a bug, which is I reported at https://github.com/sagemath/sage/issues/38112

Meanwhile you can use a custom (not efficient though) period computing function such as

def myperiod(S,mod):
    T = dict()
    k = 0
    while True:
        t = (S(k)%mod,S(k+1)%mod)
        if t in T:
            return k-T[t]
        T[t] = k
        k += 1

print( myperiod( BinaryRecurrenceSequence(3,2,u0=0,u1=1), 4 ) )