login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = prime(n)^7 mod prime(n-1).
10

%I #27 Mar 17 2023 09:55:01

%S 1,2,3,4,7,4,9,6,3,12,6,30,5,1,4,43,10,7,36,57,54,31,60,45,88,27,7,21,

%T 34,98,1,120,128,62,128,133,5,84,44,22,128,112,128,172,128,67,210,105,

%U 128

%N a(n) = prime(n)^7 mod prime(n-1).

%C a(n) = 128 if prime(n-1) and prime(n) are twin primes and prime(n-1)>128. - _Robert Israel_, Feb 12 2020

%H Robert Israel, <a href="/A138676/b138676.txt">Table of n, a(n) for n = 2..10000</a>

%e a(1)=1 because 3^7 = 1 mod 2

%e a(2)=2 because 5^7 = 2 mod 3

%p seq(ithprime(n)&^7 mod ithprime(n-1),n=2..100); # _Robert Israel_, Feb 12 2020

%t Table[Mod[Prime[n]^7, Prime[n - 1]], {n, 2, 50}]

%t (* The following program is more efficient because it only generates each prime once, but it is less easy to understand: *)

%t PowerMod[Last[#],7,First[#]]&/@Partition[Prime[Range[60]],2,1] (* _Harvey P. Dale_, Sep 02 2016 *)

%o (Magma) [NthPrime(n)^7 mod NthPrime(n-1): n in [2..50]]; // _Bruno Berselli_, May 23 2011

%o (PARI) a(n) = my(p=prime(n)); lift(Mod(p, precprime(p-1))); \\ _Michel Marcus_, Mar 17 2023

%Y Cf. A001223, A038702, A138672, A138673, A138674, A138675, A138677, A138678, A138679, A138680, A138681.

%K nonn,look

%O 2,2

%A _Artur Jasinski_, Mar 26 2008