%I #30 Nov 04 2024 01:42:09
%S 0,1,1,3,1,1,1,3,5,1,1,1,1,3,5,5,1,1,3,1,1,3,5,1,1,1,3,1,1,1,3,5,1,9,
%T 1,1,1,3,5,5,1,1,1,1,1,7,7,3,1,1,5,1,1,5,5,5,1,1,1,1,3,13,3,1,1,9,1,7,
%U 1,1,5,7,1,1,3,5,5,1,1,9,1,1,1,1,3,5,1,1,1,3,11,7,3,3,3,5,5,1,1,1,7,5,5
%N a(n) = (prime(n) mod (prime(n+1)-prime(n))).
%H Muniru A Asiru, <a href="/A060234/b060234.txt">Table of n, a(n) for n = 1..1000</a>
%F a(n) = prime(n) mod (prime(n+1) - prime(n)) where prime(n) is the n-th prime.
%e 7 is followed by 11. 7 mod (11-7) = 7 mod 4 = 3. So a(4) = 3.
%e This residue is always odd: 3 = 1*2 + 1, 7 = 1*4 + 3, 23 = 3*6 + 5, etc.
%p seq(ithprime(i) mod (ithprime(i+1)-ithprime(i)), i=1..2000); # _Muniru A Asiru_, Jan 29 2018
%t Table[Mod[Prime[n], Prime[n+1] - Prime[n]], {n, 1, 100}] (* _Vincenzo Librandi_, Jan 29 2018 *)
%o (PARI) a(n) = prime(n) % (prime(n+1) - prime(n)); \\ _Michel Marcus_, Nov 26 2013
%o (GAP) P:=Filtered([1..10^7], IsPrime);;
%o P1:=List([1..Length(P)-1], n -> P[n+1] - P[n]);;
%o A060234 := List([1..Length(P1)], n->P[n] mod P1[n]); # _Muniru A Asiru_, Jan 29 2018
%o (Magma) [NthPrime(n) mod (NthPrime(n+1)-NthPrime(n)): n in [1..100]]; // _Vincenzo Librandi_, Jan 29 2018
%o (SageMath)
%o def A060234(n): return nth_prime(n)%(nth_prime(n+1) - nth_prime(n))
%o [A060234(n) for n in range(1,121)] # _G. C. Greubel_, Nov 03 2024
%Y Cf. A000040, A001223.
%K nonn,changed
%O 1,4
%A _Labos Elemer_, Mar 21 2001