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.

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

This page as a plain text file.
%I A318972 #17 Jul 22 2025 18:20:08
%S A318972 0,2,1,5,2,9,3,12,4,16,5,19,6,23,7,26,8,30,9,33,10,37,11,40,12,44,13,
%T A318972 47,14,51,15,54,16,58,17,61,18,65,19,68,20,72,21,75,22,79,23,82,24,86,
%U A318972 25,89,26,93,27,96,28,100,29,103,30,107,31,110,32,114,33,117,34,121
%N A318972 The 7x+-1 function ("shortcut" definition): a(n) = (7n+1)/4 if n == +1 (mod 4), a(n) = (7n-1)/4 if n == -1 (mod 4), otherwise a(n) = n/2.
%C A318972 See A317640 for another definition of this problem.
%H A318972 David Barina, <a href="https://arxiv.org/abs/1807.00908">7x+-1: Close Relative of Collatz Problem</a>, arXiv:1807.00908 [math.NT], 2018.
%H A318972 K. Matthews, <a href="http://www.numbertheory.org/php/barina.html">David Barina's 7x+1 conjecture</a>.
%F A318972 a(n) = a(a(2*n))
%F A318972 From _Chai Wah Wu_, Nov 09 2018: (Start)
%F A318972 a(n) = a(n-2) + a(n-4) - a(n-6) for n > 5.
%F A318972 G.f.: x*(2*x^4 + x^3 + 3*x^2 + x + 2)/(x^6 - x^4 - x^2 + 1). (End)
%e A318972 a(3) = 5 because 3 == -1 (mod 4), and thus (7*3 - 1)/4 results in 5.
%e A318972 a(5) = 9 because 5 == +1 (mod 4), and thus (7*5 + 1)/4 results in 9.
%o A318972 (C)
%o A318972 int a(int n) {
%o A318972     switch(n%4) {
%o A318972         case 1: return (7*n+1)/4;
%o A318972         case 3: return (7*n-1)/4;
%o A318972         default: return n/2;
%o A318972     }
%o A318972 }
%o A318972 (PARI) a(n) = my(m=n%4); if (m==1, (7*n+1)/4, if (m==3, (7*n-1)/4, n/2)); \\ _Michel Marcus_, Sep 06 2018
%o A318972 (Python)
%o A318972 from __future__ import division
%o A318972 def A318972(n):
%o A318972     return (7*n+1)//4 if n % 4 == 1 else (7*n-1)//4 if n % 4 == 3 else n//2 # _Chai Wah Wu_, Nov 09 2018
%Y A318972 Cf. A014682 (3x+1 equivalent), A317640.
%K A318972 nonn,easy
%O A318972 0,2
%A A318972 _David Barina_, Sep 06 2018