Logging to /Users/s/tmp/pari-09.30 GPRC Done. GP/PARI CALCULATOR Version 2.12.1 (development 25476-78c5f8d2c) i386 running darwin (x86-64/GMP-6.2.0 kernel) 64-bit version compiled: Jun 21 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. parisizemax = 900001792, primelimit = 1000000 Logging to /Users/s/tmp/pari-09.30 GPRC Done. GP/PARI CALCULATOR Version 2.12.1 (development 25476-78c5f8d2c) i386 running darwin (x86-64/GMP-6.2.0 kernel) 64-bit version compiled: Jun 21 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. parisizemax = 900001792, primelimit = 1000000 (16:01) gp > "q^k = sumdiv(k,m,m*i(m))" %1 = "q^k = sumdiv(k,m,m*i(m))" (16:02) gp > ?sumdiv sumdiv(n,X,expr): sum of expression expr, X running over the divisors of n. (16:02) gp > ?moebius moebius(x): Moebius function of x. (16:04) gp > irr(n)=sumdiv(n,m,moebius(m)*q^m)/n %2 = (n)->sumdiv(n,m,moebius(m)*q^m)/n (16:05) gp > irr(1) %3 = q (16:05) gp > irr(2) %4 = -1/2*q^2 + 1/2*q (16:06) gp > irr(3) %5 = -1/3*q^3 + 1/3*q (16:07) gp > irr(n)=sumdiv(n,m,moebius(n/m)*q^m)/n %6 = (n)->sumdiv(n,m,moebius(n/m)*q^m)/n (16:09) gp > irr(2) %7 = 1/2*q^2 - 1/2*q (16:09) gp > irr(3) %8 = 1/3*q^3 - 1/3*q (16:09) gp > ??moebius moebius(x): Moebius mu-function of |x|; x must be a non-zero integer. The library syntax is long moebius(GEN x). (16:09) gp > ?moebius moebius(x): Moebius function of x. (16:09) gp > ???moebius dirmul forfactored forsquarefree moebius whatnow See also: "Arithmetic functions and the factoring engine" (16:09) gp > ?sumdiv sumdiv(n,X,expr): sum of expression expr, X running over the divisors of n. (16:09) gp > ??sumdiv sumdiv(n,X,expr): Sum of expression expr over the positive divisors of n. This function is a trivial wrapper essentially equivalent to D = divisors(n); sum (i = 1, #D, my(X = D[i]); eval(expr)) If expr is a multiplicative function, use sumdivmult. (16:09) gp > irr(2) %9 = 1/2*q^2 - 1/2*q (16:09) gp > irr(3) %10 = 1/3*q^3 - 1/3*q (16:09) gp > irr(4) %11 = 1/4*q^4 - 1/4*q^2 (16:09) gp > irr(5) %12 = 1/5*q^5 - 1/5*q (16:10) gp > irr(6) %13 = 1/6*q^6 - 1/6*q^3 - 1/6*q^2 + 1/6*q (16:10) gp > irr(7) %14 = 1/7*q^7 - 1/7*q (16:10) gp > irr(8) %15 = 1/8*q^8 - 1/8*q^4 (16:12) gp > irr(9) %16 = 1/9*q^9 - 1/9*q^3 (16:12) gp > irr(10) %17 = 1/10*q^10 - 1/10*q^5 - 1/10*q^2 + 1/10*q (16:12) gp > irr(11) %18 = 1/11*q^11 - 1/11*q (16:13) gp > irr(12) %19 = 1/12*q^12 - 1/12*q^6 - 1/12*q^4 + 1/12*q^2 (16:13) gp > irr(13) %20 = 1/13*q^13 - 1/13*q (16:13) gp > matrix(10,10,a,b,subst(irr(a),q,prime(b))) %21 = [2 3 5 7 11 13 17 19 23 29] [1 3 10 21 55 78 136 171 253 406] [2 8 40 112 440 728 1632 2280 4048 8120] [3 18 150 588 3630 7098 20808 32490 69828 176610] [6 48 624 3360 32208 74256 283968 495216 1287264 4102224] [9 116 2580 19544 295020 804076 4022064 7839780 24670536 99133020] [18 312 11160 117648 2783880 8964072 58619808 127695960 486403632 2464268040] [30 810 48750 720300 26793030 101962770 871959240 2122929090 9788838180 62530713210] [56 2184 217000 4483696 261994040 1178277464 13176430176 35854187880 200128072144 1611905105720] [99 5880 976248 28245840 2593726344 13785812040 201599248032 613106378136 4142650477680 42070721278824] (16:13) gp > matrix(10,10,b,a,subst(irr(a),q,prime(b))) %22 = [2 1 2 3 6 9 18 30 56 99] [3 3 8 18 48 116 312 810 2184 5880] [5 10 40 150 624 2580 11160 48750 217000 976248] [7 21 112 588 3360 19544 117648 720300 4483696 28245840] [11 55 440 3630 32208 295020 2783880 26793030 261994040 2593726344] [13 78 728 7098 74256 804076 8964072 101962770 1178277464 13785812040] [17 136 1632 20808 283968 4022064 58619808 871959240 13176430176 201599248032] [19 171 2280 32490 495216 7839780 127695960 2122929090 35854187880 613106378136] [23 253 4048 69828 1287264 24670536 486403632 9788838180 200128072144 4142650477680] [29 406 8120 176610 4102224 99133020 2464268040 62530713210 1611905105720 42070721278824] (16:13) gp > matrix(10,10,a,b,subst(irr(a),q,b)) %23 = [1 2 3 4 5 6 7 8 9 10] [0 1 3 6 10 15 21 28 36 45] [0 2 8 20 40 70 112 168 240 330] [0 3 18 60 150 315 588 1008 1620 2475] [0 6 48 204 624 1554 3360 6552 11808 19998] [0 9 116 670 2580 7735 19544 43596 88440 166485] [0 18 312 2340 11160 39990 117648 299592 683280 1428570] [0 30 810 8160 48750 209790 720300 2096640 5380020 12498750] [0 56 2184 29120 217000 1119720 4483696 14913024 43046640 111111000] [0 99 5880 104754 976248 6045837 28245840 107370900 348672528 999989991] (16:15) gp > matrix(10,10,b,a,subst(irr(a),q,b)) %24 = [ 1 0 0 0 0 0 0 0 0 0] [ 2 1 2 3 6 9 18 30 56 99] [ 3 3 8 18 48 116 312 810 2184 5880] [ 4 6 20 60 204 670 2340 8160 29120 104754] [ 5 10 40 150 624 2580 11160 48750 217000 976248] [ 6 15 70 315 1554 7735 39990 209790 1119720 6045837] [ 7 21 112 588 3360 19544 117648 720300 4483696 28245840] [ 8 28 168 1008 6552 43596 299592 2096640 14913024 107370900] [ 9 36 240 1620 11808 88440 683280 5380020 43046640 348672528] [10 45 330 2475 19998 166485 1428570 12498750 111111000 999989991]