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.

Showing 1-5 of 5 results.

A349876 If n is divisible by 3, a(n) = n; otherwise n = 3k + r with r in {1, 2} and a(n) = a(5k + r + 3). a(n) = -1 if no multiple of three will be ever reached by iterating A353314.

Original entry on oeis.org

0, 9, 6144, 3, 9, 6144, 6, 75, 15, 9, 6144, 60, 12, 24, 75, 15, 144, 30, 18, 6144, 60, 21, 39, 69, 24, 75, 45, 27, 84, 144, 30, 54, 159, 33, 6144, 60, 36, 309, 519, 39, 69, 1560, 42, 210, 75, 45, 225, 135, 48, 84, 144, 51, 150, 90, 54, 159, 450, 57, 99, 6144, 60, 294, 105, 63
Offset: 0

Views

Author

Nicholas Drozd, Dec 03 2021

Keywords

Comments

It is not known if this function is total, that is, if a(n) is well-defined for all n (this is the reason for the escape clause in the definition).
This is a so-called "Collatz-like" function, because A353313 and A353314 have some similarity to the Collatz function A006370.
The sequence can be implemented with a Turing machine with 4 states and 2 colors.

Examples

			a(1) = a(3*0 + 1) = a(5*0 + 1 + 3) = a(4)
a(4) = a(3*1 + 1) = a(5*1 + 1 + 3) = a(9)
a(9) = 9
Trajectory of a(1): 4, 9
a(7) = a(3*2 + 1) = a(5*2 + 1 + 3) = a(14)
a(14) = a(3*4 + 2) = a(5*4 + 2 + 3) = a(25)
a(25) = a(3*8 + 1) = a(5*8 + 1 + 3) = a(44)
a(44) = a(3*14 + 2) = a(5*14 + 2 + 3) = a(75)
a(75) = 75
Trajectory of a(7): 14, 25, 44, 75
Trajectory of a(2): 5, 10, 19, 34, 59, 100, 169, 284, 475, 794, 1325, 2210, 3685, 6144.
		

Crossrefs

Cf. A010872, A349877, A349896 (record values), A353313, A353314.
Cf. also A006370.

Programs

  • Mathematica
    a[n_] := a[n] = Module[{qr = QuotientRemainder[n, 3]}, If[qr[[2]] == 0, n, a[5*qr[[1]] + qr[[2]] + 3]]]; Array[a, 64, 0] (* Amiram Eldar, Jan 04 2022 *)
  • PARI
    a(n) = my(d=divrem(n, 3)); if (d[2], a(5*d[1]+d[2]+3), n); \\ Michel Marcus, Dec 05 2021
  • Python
    def a(n):
        while True:
            quot, rem = divmod(n, 3)
            if rem == 0:
                return n
            n = (5 * quot) + rem + 3
    

Formula

If A010872(n) = 0 [when n is a multiple of 3], a(n) = n, otherwise a(n) = a(A353314(n)). [Here one may also use A353313 instead of A353314] - Antti Karttunen, Apr 14 2022

Extensions

Formal escape clause added to the definition by Antti Karttunen, Apr 14 2022

A349877 a(n) is the number of times the map x -> A353314(x) needs to be applied to n to reach a multiple of 3, or -1 if the trajectory never reaches a multiple of 3.

Original entry on oeis.org

0, 2, 14, 0, 1, 13, 0, 4, 1, 0, 12, 3, 0, 1, 3, 0, 4, 1, 0, 11, 2, 0, 1, 2, 0, 2, 1, 0, 2, 3, 0, 1, 3, 0, 10, 1, 0, 4, 5, 0, 1, 7, 0, 3, 1, 0, 3, 2, 0, 1, 2, 0, 2, 1, 0, 2, 4, 0, 1, 9, 0, 3, 1, 0, 3, 4, 0, 1, 5, 0, 6, 1, 0, 4, 2, 0, 1, 2, 0, 2, 1, 0, 2, 7, 0, 1, 4, 0, 6, 1, 0, 6, 3, 0, 1, 3, 0, 5, 1, 0, 8, 2, 0
Offset: 0

Views

Author

Nicholas Drozd, Dec 03 2021

Keywords

Comments

Equally, number of iterations of A353313 needed to reach a multiple of 3, or -1 if no multiple of 3 is ever reached. - Antti Karttunen, Apr 14 2022

Examples

			a(1) = 2 : 1 -> 4 -> 9 (as it takes two applications of A353314 to reach a multiple of three),
a(2) = 14 : 2 -> 5 -> 10 -> 19 -> 34 -> 59 -> 100 -> 169 -> 284 -> 475 -> 794 -> 1325 -> 2210 -> 3685 -> 6144
a(3) = 0 : 3 (as the starting point 3 is already a multiple of 3).
a(4) = 1 : 4 -> 9
a(7) = 4 : 7 -> 14 -> 25 -> 44 -> 75.
		

Crossrefs

Programs

  • PARI
    A353314(n) = { my(r=(n%3)); if(!r,n,((5*((n-r)/3)) + r + 3)); };
    A349877(n) = { my(k=0); while(n%3, k++; n = A353314(n)); (k); }; \\ Antti Karttunen, Apr 14 2022
  • Python
    import itertools
    def f(n):
        for i in itertools.count():
            quot, rem = divmod(n, 3)
            if rem == 0:
                return i
            n = (5 * quot) + rem + 3
    

Formula

From Antti Karttunen, Apr 14 2022: (Start)
If A010872(n) = 0 then a(n) = 0, otherwise a(n) = 1 + a(A353314(n)).
a(n) < A353311(n) for all n.
(End)

Extensions

Definition corrected and more terms from Antti Karttunen, Apr 14 2022

A353313 If n is of the form 3k, then a(n) = k, and if n is of the form 3k+r, with r = 1 or 2, then a(n) = 5*k + 3 + r.

Original entry on oeis.org

0, 4, 5, 1, 9, 10, 2, 14, 15, 3, 19, 20, 4, 24, 25, 5, 29, 30, 6, 34, 35, 7, 39, 40, 8, 44, 45, 9, 49, 50, 10, 54, 55, 11, 59, 60, 12, 64, 65, 13, 69, 70, 14, 74, 75, 15, 79, 80, 16, 84, 85, 17, 89, 90, 18, 94, 95, 19, 99, 100, 20, 104, 105, 21, 109, 110, 22, 114, 115, 23, 119, 120, 24, 124, 125, 25, 129, 130, 26
Offset: 0

Views

Author

Antti Karttunen, Apr 13 2022

Keywords

Comments

It is conjectured that all iterations of this sequence starting from any n >= 0 will eventually reach a finite cycle, which by necessity then contains at least one multiple of three. See Drozd links and A349876.

Crossrefs

Cf. A353305 (the smallest number reached after the starting point n), A353309 (the largest base-3 digit sum reached after the starting point n).

Programs

  • Mathematica
    Table[With[{c=Mod[n,3]},If[c==0,n/3,(5n-2c+9)/3]],{n,0,80}]  (* Harvey P. Dale, Aug 09 2025 *)
  • PARI
    A353313(n) = { my(r=(n%3)); if(!r,n/3,((5*((n-r)/3)) + r + 3)); };

A102899 a(n) = ceiling(n/3)^2 - floor(n/3)^2.

Original entry on oeis.org

0, 1, 1, 0, 3, 3, 0, 5, 5, 0, 7, 7, 0, 9, 9, 0, 11, 11, 0, 13, 13, 0, 15, 15, 0, 17, 17, 0, 19, 19, 0, 21, 21, 0, 23, 23, 0, 25, 25, 0, 27, 27, 0, 29, 29, 0, 31, 31, 0, 33, 33, 0, 35, 35, 0, 37, 37, 0, 39, 39, 0, 41, 41, 0, 43, 43, 0, 45, 45, 0, 47, 47, 0, 49, 49, 0, 51, 51, 0, 53, 53, 0
Offset: 0

Views

Author

Paul Barry, Jan 17 2005

Keywords

Comments

If n is a multiple of 3, then a(n) = 0, and if n is of the form 3k+r, with r = 1 or 2, then a(n) = 2*k + 1. - Antti Karttunen, Apr 14 2022

References

  • Maria Paola Bonacina and Nachum Dershowitz, Canonical Inference for Implicational Systems, in Automated Reasoning, Lecture Notes in Computer Science, Volume 5195/2008, Springer-Verlag.

Crossrefs

Programs

  • Magma
    I:=[0,1,1,0,3,3]; [n le 6 select I[n] else 2*Self(n-3) - Self(n-6): n in [1..91]]; // G. C. Greubel, Dec 09 2022
    
  • Mathematica
    LinearRecurrence[{0,0,2,0,0,-1}, {0,1,1,0,3,3}, 90] (* G. C. Greubel, Dec 09 2022 *)
  • PARI
    A102899(n)=(n\3*2+1)*(0M. F. Hasler, Dec 13 2007
    
  • SageMath
    def A102899(n): return (1+2*(n//3))*((n%3)>0)
    [A102899(n) for n in range(91)] # G. C. Greubel, Dec 09 2022

Formula

G.f.: x*(1+x+x^3+x^4)/(1-2*x^3+x^6).
a(n) = A011655(n)*A004396(n).
a(n) = (2/3)*floor((2*n+1)/3)*(1-cos(2*Pi*n/3)).
From M. F. Hasler, Dec 13 2007: (Start)
a(n) = |A120691(n+1)| for n>0.
a(n) = ([n/3]*2 + 1)*dist(n,3Z). (End)
a(n) = 2*sin(n*Pi/3)*(4*n*sin(n*Pi/3)-sqrt(3)*cos(n*Pi))/9. - Wesley Ivan Hurt, Sep 24 2017
a(n) = 2*a(n-3) - a(n-6), for n > 5. - Chai Wah Wu, Jul 27 2022

A353327 If n is a multiple of 3, then a(n) = 0, and if n is of the form 3k+r, with r = 1 or 2, then a(n) = 2*k + 3.

Original entry on oeis.org

0, 3, 3, 0, 5, 5, 0, 7, 7, 0, 9, 9, 0, 11, 11, 0, 13, 13, 0, 15, 15, 0, 17, 17, 0, 19, 19, 0, 21, 21, 0, 23, 23, 0, 25, 25, 0, 27, 27, 0, 29, 29, 0, 31, 31, 0, 33, 33, 0, 35, 35, 0, 37, 37, 0, 39, 39, 0, 41, 41, 0, 43, 43, 0, 45, 45, 0, 47, 47, 0, 49, 49, 0, 51, 51, 0, 53, 53, 0, 55, 55, 0, 57, 57, 0, 59, 59, 0
Offset: 0

Views

Author

Antti Karttunen, Apr 14 2022

Keywords

Crossrefs

Programs

  • PARI
    A353327(n) = { my(r=(n%3)); if(!r,0,((2*((n-r)/3)) + 3)); };

Formula

a(n) = A353314(n) - n.
a(n) = A102899(3+n).
From Chai Wah Wu, Jul 27 2022: (Start)
a(n) = 2*a(n-3) - a(n-6) for n > 5.
G.f.: x*(-x^4 - x^3 + 3*x + 3)/(x^6 - 2*x^3 + 1). (End)
Showing 1-5 of 5 results.