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.

A000689 Final decimal digit of 2^n.

Original entry on oeis.org

1, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6
Offset: 0

Views

Author

Keywords

Comments

These are the analogs of the powers of 2 in carryless arithmetic mod 10.
Let G = {2,4,8,6}. Let o be defined as XoY = least significant digit in XY. Then (G,o) is an Abelian group wherein 2 is a generator (also see the first comment under A001148). - K.V.Iyer, Mar 12 2010
This is also the decimal expansion of 227/1818. - Kritsada Moomuang, Dec 21 2021

Examples

			G.f. = 1 + 2*x + 4*x^2 + 8*x^3 + 6*x^4 + 2*x^5 + 4*x^6 + 8*x^7 + 6*x^8 + ...
		

Crossrefs

Programs

  • Haskell
    a000689 n = a000689_list !! n
    a000689_list = 1 : cycle [2,4,8,6]  -- Reinhard Zumkeller, Sep 15 2011
  • Magma
    [2^n mod 10: n in [0..150]]; // Vincenzo Librandi, Apr 12 2011
    
  • Mathematica
    Table[PowerMod[2, n, 10], {n, 0, 200}] (* Vladimir Joseph Stephan Orlovsky, Jun 10 2011 *)
  • PARI
    for(n=0,80, if(n,{x=(n+3)%4+1; print1(10-(4*x^3+47*x-27*x^2)/3,", ")},{print1("1, ")}))
    
  • SageMath
    [power_mod(2,n,10)for n in range(0, 81)] # Zerinvary Lajos, Nov 03 2009
    

Formula

Periodic with period 4.
a(n) = 2^n mod 10.
a(n) = A002081(n) - A002081(n-1), for n > 0.
From R. J. Mathar, Apr 13 2010: (Start)
a(n) = a(n-1) - a(n-2) + a(n-3), n > 3.
G.f.: (x+3*x^2+5*x^3+1)/((1-x) * (1+x^2)). (End)
For n >= 1, a(n) = 10 - (4x^3 + 47x - 27x^2)/3, where x = (n+3) mod 4 + 1.
For n >= 1, a(n) = A070402(n) + 5*floor( ((n-1) mod 4)/2 ).
G.f.: 1 / (1 - 2*x / (1 + 5*x^3 / (1 + x / (1 - 3*x / (1 + 3*x))))). - Michael Somos, May 12 2012
a(n) = 5 + cos((n*Pi)/2) - 3*sin((n*Pi)/2) for n >= 1. - Kritsada Moomuang, Dec 21 2021