Philippe de Rochambeau on Mon, 15 Nov 2021 14:08:04 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Cycle structure


For those of you that might be interested, here’s my implementation of the Caesar Cypher in PariGP:


alphabet = Vecsmall("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
get(v,i) = v[((i)%#v)+1];

caesar(s,n) = {
    n1 = [ get(n, i + s) | i <- [0 .. #n - 1] ];
    strchr(n1)
}
c = caesar(3, alphabet)
print(c)




Le 15 nov. 2021 à 13:44, Philippe de Rochambeau <phiroc@free.fr> a écrit :

Thank you (merci), Pascal. 

? a
%23 = Vecsmall([97, 98, 99])
? get(a,1)
%24 = 98
? get(a,2)
%25 = 99
? get(a,3)
%26 = 97




Le 15 nov. 2021 à 13:38, Pascal Molin <molin@math.univ-paris-diderot.fr> a écrit :

get(v,i) = v[((i-1)%#v)+1]