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.

A170821 Let p = n-th prime; a(n) = smallest k >= 0 such that 4k == 3 mod p.

This page as a plain text file.
%I A170821 #20 Dec 03 2018 18:32:00
%S A170821 0,2,6,9,4,5,15,18,8,24,10,11,33,36,14,45,16,51,54,19,60,63,23,25,26,
%T A170821 78,81,28,29,96,99,35,105,38,114,40,123,126,44,135,46,144,49,50,150,
%U A170821 159,168,171,58,59,180,61,189,65,198,68,204,70,71,213,74,231,234,79,80,249,85,261
%N A170821 Let p = n-th prime; a(n) = smallest k >= 0 such that 4k == 3 mod p.
%H A170821 Robert Israel, <a href="/A170821/b170821.txt">Table of n, a(n) for n = 2..10000</a>
%H A170821 I. Anderson and D. A. Preece, <a href="http://dx.doi.org/10.1016/j.disc.2008.09.046">Combinatorially fruitful properties of 3*2^(-1) and 3*2^(-2) modulo p</a>, Discr. Math., 310 (2010), 312-324.
%F A170821 a(n) = (prime(n)+3)/4 if n is in A080147, (3*prime(n)+3)/4 if n is in A080148 (except for n=2). - _Robert Israel_, Dec 03 2018
%p A170821 f:=proc(n) local b; for b from 0 to n-1 do if 4*b mod n = 3 then RETURN(b); fi; od: -1; end; [seq(f(ithprime(n)),n=2..100)]; # Gives wrong answer for n=2.
%p A170821 # Alternative:
%p A170821 f:= n -> 3/4 mod ithprime(n):
%p A170821 map(f, [$2..100]); # _Robert Israel_, Dec 03 2018
%t A170821 a[n_] := If[n<3, 0, Module[{p=Prime[n], k=0}, While[Mod[4k, p] != 3, k++]; k]]; Array[a, 100,2] (* _Amiram Eldar_, Dec 03 2018 *)
%o A170821 (PARI) a(n) = my(p=prime(n), k=0); while(Mod(4*k, p) != 3, k++); k; \\ _Michel Marcus_, Dec 03 2018
%Y A170821 Cf. A000040, A080147, A080148.
%K A170821 nonn,look
%O A170821 2,2
%A A170821 _N. J. A. Sloane_, Dec 24 2009