login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Nonprimes k such that 3^k == 3 (mod k).
16

%I #23 Apr 30 2023 11:20:38

%S 1,6,66,91,121,286,561,671,703,726,949,1105,1541,1729,1891,2465,2665,

%T 2701,2821,3281,3367,3751,4961,5551,6601,7107,7381,8205,8401,8646,

%U 8911,10585,11011,12403,14383,15203,15457,15841,16471,16531,18721,19345

%N Nonprimes k such that 3^k == 3 (mod k).

%C Theorem: If q!=3 and both numbers q and (2q-1) are primes then k=q*(2q-1) is in the sequence. 6, 91, 703, 1891, 2701, 12403, 18721, 38503, 49141, ... is the related subsequence.

%C The terms > 1 and coprime to 3 of this sequence are the base-3 pseudoprimes, A005935. - _M. F. Hasler_, Jul 19 2012 [Corrected by _Jianing Song_, Feb 06 2019]

%H Amiram Eldar, <a href="/A122780/b122780.txt">Table of n, a(n) for n = 1..10000</a>

%e 66 is composite and 3^66 = 66*468229611858069884271524875811 + 3 so 66 is in the sequence.

%p isA122780 := proc(n)

%p if isprime(n) then

%p false;

%p else

%p modp( 3 &^ n,n) = modp(3,n) ;

%p end if;

%p end proc:

%p for n from 1 do

%p if isA122780(n) then

%p print(n) ;

%p end if;

%p end do: # _R. J. Mathar_, Jul 15 2012

%t Select[Range[30000], ! PrimeQ[ # ] && Mod[3^#, # ] == Mod[3, # ] &]

%t Join[{1},Select[Range[20000],!PrimeQ[#]&&PowerMod[3,#,#]==3&]] (* _Harvey P. Dale_, Apr 30 2023 *)

%o (PARI) is_A122780(n)={n>0 & Mod(3, n)^n==3 & !ispseudoprime(n)} \\ _M. F. Hasler_, Jul 19 2012

%Y Cf. A001567, A005935, A122014.

%Y Cf. A122781, A122782, A122783, A122784, A122785, A122786.

%K easy,nonn

%O 1,2

%A _Farideh Firoozbakht_, Sep 11 2006