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.

A317640 The 7x+-1 function: a(n) = 7n+1 if n == +1 (mod 4), a(n) = 7n-1 if n == -1 (mod 4), otherwise a(n) = n/2.

This page as a plain text file.
%I A317640 #26 Jul 22 2025 17:12:11
%S A317640 0,8,1,20,2,36,3,48,4,64,5,76,6,92,7,104,8,120,9,132,10,148,11,160,12,
%T A317640 176,13,188,14,204,15,216,16,232,17,244,18,260,19,272,20,288,21,300,
%U A317640 22,316,23,328,24,344,25,356,26,372,27,384,28,400,29,412,30,428,31,440,32,456,33
%N A317640 The 7x+-1 function: a(n) = 7n+1 if n == +1 (mod 4), a(n) = 7n-1 if n == -1 (mod 4), otherwise a(n) = n/2.
%C A317640 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.
%H A317640 Colin Barker, <a href="/A317640/b317640.txt">Table of n, a(n) for n = 0..1000</a>
%H A317640 D. Barina, <a href="https://arxiv.org/abs/1807.00908">7x+-1: Close Relative of Collatz Problem</a>, arXiv:1807.00908 [math.NT], 2018.
%H A317640 K. Matthews, <a href="http://www.numbertheory.org/php/barina.html">David Barina's 7x+1 conjecture</a>.
%H A317640 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,1,0,1,0,-1).
%F A317640 a(n) = a(a(2*n)).
%F A317640 From _Colin Barker_, Aug 03 2018: (Start)
%F A317640 G.f.: x*(8 + x + 12*x^2 + x^3 + 8*x^4) / ((1 - x)^2*(1 + x)^2*(1 + x^2)).
%F A317640 a(n) = a(n-2) + a(n-4) - a(n-6) for n>5.
%F A317640 (End)
%e A317640 a(3)=20 because 3 == -1 (mod 4), and thus 7*3 - 1 results in 20.
%e A317640 a(5)=36 because 5 == +1 (mod 4), and thus 7*5 + 1 results in 36.
%t A317640 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 *)
%o A317640 (C)
%o A317640 int a(int n) {
%o A317640     switch(n%4) {
%o A317640         case 1: return 7*n+1;
%o A317640         case 3: return 7*n-1;
%o A317640         default: return n/2;
%o A317640     }
%o A317640 }
%o A317640 (PARI) a(n)={my(m=(n+2)%4-2); if(m%2, 7*n + m, n/2)} \\ _Andrew Howroyd_, Aug 02 2018
%o A317640 (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
%Y A317640 Cf. A006370.
%K A317640 nonn,easy
%O A317640 0,2
%A A317640 _David Barina_, Aug 02 2018