cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A062173 a(n) = 2^(n-1) mod n.

This page as a plain text file.
%I A062173 #42 May 17 2023 16:44:03
%S A062173 0,0,1,0,1,2,1,0,4,2,1,8,1,2,4,0,1,14,1,8,4,2,1,8,16,2,13,8,1,2,1,0,4,
%T A062173 2,9,32,1,2,4,8,1,32,1,8,31,2,1,32,15,12,4,8,1,14,49,16,4,2,1,8,1,2,4,
%U A062173 0,16,32,1,8,4,22,1,32,1,2,34,8,9,32,1,48,40,2,1,32,16,2,4,40,1,32,64,8,4,2,54,32,1,58,58,88,1,32,1,24,46
%N A062173 a(n) = 2^(n-1) mod n.
%C A062173 If p is an odd prime then a(p)=1. However, a(n) is also 1 for pseudoprimes to base 2 such as 341.
%H A062173 Antti Karttunen, <a href="/A062173/b062173.txt">Table of n, a(n) for n = 1..101101</a> (first 1000 terms from Harry J. Smith)
%H A062173 <a href="/index/Ps#pseudoprimes">Index entries for sequences related to pseudoprimes</a>
%F A062173 a(n) = A106262(2*n-3, n-2). - _G. C. Greubel_, Jan 11 2023
%e A062173 a(5) = 2^(5-1) mod 5 = 16 mod 5 = 1.
%t A062173 Array[Mod[2^(# - 1), #] &, 105] (* _Michael De Vlieger_, Jul 01 2018 *)
%t A062173 Array[PowerMod[2,#-1,#]&,120] (* _Harvey P. Dale_, May 17 2023 *)
%o A062173 (PARI) A062173(n) = if(1==n, 0, lift(Mod(2, n)^(n-1))); \\ _Antti Karttunen_, Jul 01 2018
%o A062173 (Haskell)
%o A062173 import Math.NumberTheory.Moduli (powerMod)
%o A062173 a062173 n = powerMod 2 (n - 1) n  -- _Reinhard Zumkeller_, Oct 17 2015
%o A062173 (Magma) [Modexp(2,n-1,n): n in [1..110]]; // _G. C. Greubel_, Jan 11 2023
%o A062173 (SageMath) [power_mod(2,n-1,n) for n in range(1,110)] # _G. C. Greubel_, Jan 11 2023
%Y A062173 Cf. A000079, A001567, A015910, A015919, A062172.
%Y A062173 Cf. A082495, A106262, A257531, A305890.
%Y A062173 Cf. A176997 (after the initial term, gives the positions of ones).
%K A062173 nonn
%O A062173 1,6
%A A062173 _Henry Bottomley_, Jun 12 2001
%E A062173 More terms from _Antti Karttunen_, Jul 01 2018