A163782 a(n) is the n-th J_2-prime (Josephus_2 prime).
2, 5, 6, 9, 14, 18, 26, 29, 30, 33, 41, 50, 53, 65, 69, 74, 81, 86, 89, 90, 98, 105, 113, 134, 146, 158, 173, 174, 186, 189, 194, 209, 210, 221, 230, 233, 245, 254, 261, 270, 273, 278, 281, 293, 306, 309, 326, 329
Offset: 1
Keywords
Examples
p(1,5)=3, p(2,5)=1, p(3,5)=5, p(4,5)=2 and p(5,5)=4. So p=(1 3 5 4 2) and 5 is J_2-prime.
References
- R. L. Graham, D. E. Knuth & O. Patashnik, Concrete Mathematics (1989), Addison-Wesley, Reading, MA. Sections 1.3 & 3.3.
Links
- P. R. J. Asveld, Table of n, a(n) for n = 1..6706
- Jean-Paul Allouche, Manon Stipulanti, and Jia-Yan Yao, Doubling modulo odd integers, generalizations, and unexpected occurrences, arXiv:2504.17564 [math.NT], 2025.
- P. R. J. Asveld, Permuting operations on strings and their relation to prime numbers, Discrete Applied Mathematics 159 (2011) 1915-1932.
- P. R. J. Asveld, Permuting operations on strings and the distribution of their prime numbers (2011), TR-CTIT-11-24, Dept. of CS, Twente University of Technology, Enschede, The Netherlands; alternative link.
- P. R. J. Asveld, Some Families of Permutations and Their Primes (2009), TR-CTIT-09-27, Dept. of CS, Twente University of Technology, Enschede, The Netherlands.
- Eric Weisstein's World of Mathematics, Josephus Problem
- Wikipedia, Josephus Problem
- Index entries for sequences related to the Josephus Problem
Crossrefs
Programs
-
Java
isJ2Prime(int n) { // for n > 1 int count = 0, leader = 0; if (n % 4 == 1 || n % 4 == 2) { // small optimization do { leader = A025480(leader + n); count++; } while (leader != 0); } return count == n; } // Joe Nellis, Jan 27 2023
-
Mathematica
lst = {}; Do[If[IntegerQ[(2^n + 1)/(2 n + 1)] && PrimitiveRoot[2 n + 1] == 2, AppendTo[lst, n]], {n, 2, 10^5}]; lst (* Hilko Koning, Sep 21 2021 *)
-
PARI
Follow(s,f)={my(t=f(s),k=1); while(t>s, k++; t=f(t)); if(s==t, k, 0)} ok(n)={my(d=2*n+1); n>1&&n==Follow(1,i->(d-((d-i)>>valuation(d-i, 2)))/2)} select(n->ok(n),[1..1000]) \\ Andrew Howroyd, Nov 11 2017
-
PARI
forprime(p=5, 2000, if(znorder(Mod(2, p))==p-1, print1((p-1)/2, ", "))); \\ Andrew Howroyd, Nov 11 2017
Formula
a(n) = A071642(n+3)/2.
Comments