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.

A255873 The first nonzero digit of n/7.

Original entry on oeis.org

1, 2, 4, 5, 7, 8, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Kit Scriven, Mar 08 2015

Keywords

Examples

			The leading (most significant) digit of 22/7 in A068028 is 3, so a(22)=3.
		

Crossrefs

Cf. A020806 (1/7), A068028 (22/7), A216606 (360/7).

Programs

  • Maple
    A255873 := proc(n)
        local nshf ;
        nshf := n/7 ;
        while nshf < 1 do
            nshf := 10*nshf;
        end do;
        while nshf >= 10 do
            nshf := nshf/10;
        end do;
        floor(nshf) ;
    end proc: # R. J. Mathar, May 28 2016
  • Mathematica
    f[n_] := RealDigits[n/7, 10, 9][[1, 1]]; Array[f, 105] (* Robert G. Wilson v, Mar 08 2015 *)
  • PARI
    a(n) = {my(x = n/7.0); if (x < 1, x *= 10); while (x >= 10, x /= 10); floor(x);} \\ Michel Marcus, Mar 12 2015