OEIS

The On-Line Encyclopedia of Integer Sequences®

Modern Implementation for Coders and Agents
Examples: 1, 1, 2, 3, 5, 8 • A000045 • Fibonacci • author:Guglielmetti

A003893

a(n) = Fibonacci(n) mod 10.

(list)   (graph)   (refs)   (listen)   (history)   (text)   (edit)

DATA

0, 1, 1, 2, 3, 5, 8, 3, 1, 4, 5, 9, 4, 3, 7, 0, 7, 7, 4, 1, 5, 6, 1, 7, 8, 5, 3, 8, 1, 9, 0, 9, 9, 8, 7, 5, 2, 7, 9, 6, 5, 1, 6, 7, 3, 0, 3, 3, 6, 9, 5, 4, 9, 3, 2, 5, 7, 2, 9, 1, 0, 1, 1, 2, 3, 5, 8, 3, 1, 4, 5, 9, 4, 3, 7, 0, 7, 7, 4, 1, 5, 6, 1, 7, 8, 5, 3, 8, 1, 9, 0, 9, 9, 8, 7, 5, 2, 7, 9, 6, 5, 1, 6, 7, 3

METADATA

COMMENTS

FORMULA

REFERENCES

PROGRAMS

Maple

with(combinat,fibonacci); A003893 := proc(n) fibonacci(n) mod 10; end;

Mathematica

Table[Mod[Fibonacci[n], 10], {n, 0, 99}] (* _Alonso del Arte_, Jul 29 2013 *)
Table[IntegerDigits[Fibonacci[n]][[-1]], {n, 0, 99}] (* _Alonso del Arte_, Jul 29 2013 *)
NumberDigit[Fibonacci[Range[0,120]],0] (* Requires Mathematica version 12 or later *) (* _Harvey P. Dale_, Jul 05 2021 *)

Other Programs

a003893 n = a003893_list !! n
a003893_list = 0 : 1 : zipWith (\u v -> (u + v) `mod` 10)
                       (tail a003893_list) a003893_list
-- _Reinhard Zumkeller_, Jul 01 2013
a(n)=fibonacci(n)%10 \\ _Charles R Greathouse IV_, Feb 03 2014
[Fibonacci(n) mod 10: n in [0..100]]; // _Vincenzo Librandi_, Feb 04 2014
A003893_list, a, b, = [], 0, 1
for _ in range(10**3):
    A003893_list.append(a)
    a, b = b, (a+b) % 10 # _Chai Wah Wu_, Nov 26 2015

PYTHON IMPLEMENTATION

Executable sequence implementation based on goulib.sequence.Sequence:

Main definition:

A003893 = Sequence(math2.fibonacci_gen(mod=10),
                   desc='Fibonacci numbers modulo 10')

Detail of provided methods:

Function Expression Description
iterf math2.fibonacci_gen(mod=10) Generator iterating over the infinite sequence
itemf(n) (sequential evaluation) Direct computation of $n$-th term
containf(x) (monotonic search) Boolean membership test ($x \in S$)

CROSSREFERENCES

EXTENSIONS AND ERRORS

⚙ Live Sequence Evaluation Console

Test the itemf(n) and containf(x) functions directly in this page:

Result ready. Click a button above.