A318712 Numbers k for which a riffle shuffle permutation with two or more packets permutes all except the first and the last of the k cards.
4, 6, 12, 14, 18, 20, 30, 38, 42, 54, 60, 62, 68, 84, 90, 98, 102, 108, 110, 114, 132, 138, 140, 150, 164, 174, 180, 182, 198, 212, 228, 230, 234, 252, 258, 270, 282, 294, 308, 318, 348, 350, 354, 374, 380, 390, 402, 420, 422, 434, 444, 450, 462, 468, 492, 500, 510, 522, 524, 542, 548, 558, 564
Offset: 1
Keywords
Links
- Mauro Rigo, Table of n, a(n) for n = 1..5000
Programs
-
MATLAB
arr = []; for i = 4:1000 pdiv = 2:ceil(sqrt(i)); divisors = pdiv(rem(i, pdiv)==0); stop = 0; for j = divisors if ~stop ndiv = j; neldiv = i/j; a0 = 1; b0 = 2; a = a0; b = b0; a1 = 0; b1 = 0; operations = 0; while a1~=a0 || b1~=b0 b1 = mod((b-1)*ndiv+a-1, neldiv)+1; a1 = floor(((b-1)*ndiv+a-1)/neldiv)+1; operations = operations + 1; a = a1; b = b1; end if operations==i-2 arr = [arr, i]; stop = 1; end end end end
Formula
Apparently a(n) = A225184(n+1) + 1.
Comments