OFFSET
1,4
COMMENTS
Inspired by Fermat's Little Theorem.
a(n) > 0 for n > 1 since n and b are coprime.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Wikipedia, Fermat's little theorem
FORMULA
a(n) = 0 iff n = 1.
a(n) = 2 iff n>1 and belongs to A173572;
a(n) = 4 iff n belongs to A033553;
a(n) = 16 iff n>15 and belongs to A276968;
a(n) = 32 iff n>1 and belongs to A215610;
a(n) = 64 iff n>63 and belongs to A276969;
a(n) = 128 iff n>127 and belongs to A215611;
a(n) = 256 iff n>255 and belongs to A276970;
a(n) = 512 iff n>511 and belongs to A215612;
a(n) = 1024 iff n>1023 and belongs to A276971;
a(n) = 2048 iff n>2047 and belongs to A215613;
From Robert Israel, Jun 18 2025: (Start)
a(2*p) = 3 if p is a prime > 3.
a(3*p) = 4 if p is a prime > 2.
a(4*p) = 3^3 if p is a prime > 5.
a(6*p) = 5^5 if p is a prime > 509.
a(8*p) = 3^5 if p is a prime > 271.
a(10*p) = 3^9 if p is a prime > 1951.
a(12*p) = 5^11 if p is a prime > 4069003. (End)
MAPLE
f:= proc(n) local b;
b:= 2;
while n mod b = 0 do b:= nextprime(b) od;
b &^ (n-1) mod n
end proc:
f(1):= 0:
map(f, [$1..100]); # Robert Israel, Jun 18 2025
MATHEMATICA
a[n_] := Block[{b = 2}, While[GCD[n, b] > 1, b++]; PowerMod[b, n - 1, n]]; Array[a, 84]
PROG
(PARI) a(n) = forprime(p=2, , if(n%p, return(lift(Mod(p, n)^(n-1))))); \\ Michel Marcus, Jun 18 2025
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Robert G. Wilson v, Jun 16 2025
STATUS
approved
