arara:# gp GP/PARI CALCULATOR Version 2.12.1 (development 25142-46eb34041) i386 running darwin (x86-64/GMP-6.2.0 kernel) 64-bit version compiled: Mar 22 2020, Apple clang version 11.0.0 (clang-1100.0.33.17) threading engine: single (readline v8.0 enabled, extended help enabled) Copyright (C) 2000-2020 The PARI Group PARI/GP is free software, covered by the GNU General Public License, and comes WITHOUT ANY WARRANTY WHATSOEVER. Type ? for help, \q to quit. Type ?17 for how to get moral (and possibly technical) support. parisize = 8000000, primelimit = 500000 ? ? Help topics: for a list of relevant subtopics, type ?n for n in 0: user-defined functions (aliases, installed and user functions) 1: PROGRAMMING under GP 2: Standard monadic or dyadic OPERATORS 3: CONVERSIONS and similar elementary functions 4: functions related to COMBINATORICS 5: NUMBER THEORETICAL functions 6: POLYNOMIALS and power series 7: Vectors, matrices, LINEAR ALGEBRA and sets 8: TRANSCENDENTAL functions 9: SUMS, products, integrals and similar functions 10: General NUMBER FIELDS 11: Associative and central simple ALGEBRAS 12: ELLIPTIC CURVES 13: L-FUNCTIONS 14: MODULAR FORMS 15: MODULAR SYMBOLS 16: GRAPHIC functions 17: The PARI community Also: ? functionname (short on-line help) ?\ (keyboard shortcuts) ?. (member functions) Extended help (if available): ?? (opens the full user's manual in a dvi previewer) ?? tutorial / refcard / libpari (tutorial/reference card/libpari manual) ?? refcard-ell (or -lfun/-mf/-nf: specialized reference card) ?? keyword (long help text about "keyword" from the user's manual) ??? keyword (a propos: list of related functions). ? ?znprimroot znprimroot(n): returns a primitive root of n when it exists. ? ??znprimroot ? znprimroot(2) %1 = Mod(1, 2) ? znprimroot(3) %2 = Mod(2, 3) ? znprimroot(4) %3 = Mod(3, 4) ? znprimroot(5) %4 = Mod(2, 5) ? vector(4,n,Mod(2^n,5)) %5 = [Mod(2, 5), Mod(4, 5), Mod(3, 5), Mod(1, 5)] ? liftint(%) %6 = [2, 4, 3, 1] ? poderes(x,p) = liftint(vector(p,n,Mod(x,p)^n)) %7 = (x,p)->liftint(vector(p,n,Mod(x,p)^n)) ? poderes(2,5) %8 = [2, 4, 3, 1, 2] ? poderes(2,6) %9 = [2, 4, 2, 4, 2, 4] ? poderes(5,6) %10 = [5, 1, 5, 1, 5, 1] ? 25 == 1+4*6 %11 = 1 ? poderes(2,7) %12 = [2, 4, 1, 2, 4, 1, 2] ? a= Mod(2,7) %13 = Mod(2, 7) ? a^2 %14 = Mod(4, 7) ? a^3 %15 = Mod(1, 7) ? 2^3 == Mod(1,7) %16 = 1 ? Mod(2,7)^3 == 1 %17 = 1 ? "Então 2 não é gerador de grupo multiplicativo modulo 7, mas é gerador modulo 5" %18 = "Então 2 não é gerador de grupo multiplicativo modulo 7, mas é gerador modulo 5" ? poderes(2,7) %19 = [2, 4, 1, 2, 4, 1, 2] ? poderes(3,7) %20 = [3, 2, 6, 4, 5, 1, 3] ? "3 é um gerador" %21 = "3 é um gerador" ? znprimroot(5) %22 = Mod(2, 5) ? znprimroot(7) %23 = Mod(3, 7) ? znprimroot(8) *** at top-level: znprimroot(8) *** ^------------- *** znprimroot: domain error in znprimroot: argument = 8 *** Break loop: type 'break' to go back to GP prompt break> break ? poderes(1,8) %24 = [1, 1, 1, 1, 1, 1, 1, 1] ? poderes(2,8) %25 = [2, 4, 0, 0, 0, 0, 0, 0] ? poderes(3,8) %26 = [3, 1, 3, 1, 3, 1, 3, 1] ? poderes(4,8) %27 = [4, 0, 0, 0, 0, 0, 0, 0] ? poderes(5,8) %28 = [5, 1, 5, 1, 5, 1, 5, 1] ? poderes(6,8) %29 = [6, 4, 0, 0, 0, 0, 0, 0] ? poderes(7,8) %30 = [7, 1, 7, 1, 7, 1, 7, 1] ? matrix(8,8,a,b,liftint(Mod(a^b,8))) %31 = [1 1 1 1 1 1 1 1] [2 4 0 0 0 0 0 0] [3 1 3 1 3 1 3 1] [4 0 0 0 0 0 0 0] [5 1 5 1 5 1 5 1] [6 4 0 0 0 0 0 0] [7 1 7 1 7 1 7 1] [0 0 0 0 0 0 0 0] ? znprimroot(9) %32 = Mod(2, 9) ? poderes(2,9) %33 = [2, 4, 8, 7, 5, 1, 2, 4, 8] ? znprimroot(11) %34 = Mod(2, 11) ? znprimroot(13) %35 = Mod(2, 13) ? vector(50,n,p=prime(n),znprimroot(p)) *** too many arguments: vector(50,n,p=prime(n),znprimroot(p)) *** ^-------------- ? vector(50,n,p=prime(n);znprimroot(p)) %36 = [Mod(1, 2), Mod(2, 3), Mod(2, 5), Mod(3, 7), Mod(2, 11), Mod(2, 13), Mod(3, 17), Mod(2, 19), Mod(5, 23), Mod(2, 29), Mod(3, 31), Mod(2, 37), Mod(6, 41), Mod(3, 43), Mod(5, 47), Mod(2, 53), Mod(2, 59), Mod(2, 61), Mod(2, 67), Mod(7, 71), Mod(5, 73), Mod(3, 79), Mod(2, 83), Mod(3, 89), Mod(5, 97), Mod(2, 101), Mod(5, 103), Mod(2, 107), Mod(6, 109), Mod(3, 113), Mod(3, 127), Mod(2, 131), Mod(3, 137), Mod(2, 139), Mod(2, 149), Mod(6, 151), Mod(5, 157), Mod(2, 163), Mod(5, 167), Mod(2, 173), Mod(2, 179), Mod(2, 181), Mod(19, 191), Mod(5, 193), Mod(2, 197), Mod(3, 199), Mod(2, 211), Mod(3, 223), Mod(2, 227), Mod(6, 229)] ? factor(228) %37 = [ 2 2] [ 3 1] [19 1] ? isprime(229) %38 = 1 ? Goodbye!