OFFSET
0,2
COMMENTS
The 7x+-1 problem is as follows. Start with any natural number n. If 4 divides n-1, multiply it by 7 and add 1; if 4 divides n+1, multiply it by 7 and subtract 1; otherwise divide it by 2. The 7x+-1 problem concerns the question whether we always reach 1.
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
D. Barina, 7x+-1: Close Relative of Collatz Problem, arXiv:1807.00908 [math.NT], 2018.
K. Matthews, David Barina's 7x+1 conjecture.
Index entries for linear recurrences with constant coefficients, signature (0,1,0,1,0,-1).
FORMULA
a(n) = a(a(2*n)).
From Colin Barker, Aug 03 2018: (Start)
G.f.: x*(8 + x + 12*x^2 + x^3 + 8*x^4) / ((1 - x)^2*(1 + x)^2*(1 + x^2)).
a(n) = a(n-2) + a(n-4) - a(n-6) for n>5.
(End)
EXAMPLE
a(3)=20 because 3 == -1 (mod 4), and thus 7*3 - 1 results in 20.
a(5)=36 because 5 == +1 (mod 4), and thus 7*5 + 1 results in 36.
MATHEMATICA
Array[Which[#2 == 1, 7 #1 + 1, #2 == 3, 7 #1 - 1, True, #1/2] & @@ {#, Mod[#, 4]} &, 67, 0] (* Michael De Vlieger, Aug 02 2018 *)
PROG
(C)
int a(int n) {
....switch(n%4) {
........case 1: return 7*n+1;
........case 3: return 7*n-1;
........default: return n/2;
....}
}
(PARI) a(n)={my(m=(n+2)%4-2); if(m%2, 7*n + m, n/2)} \\ Andrew Howroyd, Aug 02 2018
(PARI) concat(0, Vec(x*(8 + x + 12*x^2 + x^3 + 8*x^4) / ((1 - x)^2*(1 + x)^2*(1 + x^2)) + O(x^70))) \\ Colin Barker, Aug 03 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
David Barina, Aug 02 2018
STATUS
approved