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-2 of 2 results.

A054055 Largest digit of n.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Apr 29 2000

Keywords

Comments

A095815(n) = n + a(n). - Reinhard Zumkeller, Aug 23 2011
a(A007088(n)) = 1, n > 0; a(A136399(n)) > 1. - Reinhard Zumkeller, Apr 25 2012
a(n) = 9 for almost all n. Sum_{n < x} a(n) = 9x + O(.956^x). - Charles R Greathouse IV, Oct 02 2013

Examples

			a(12)=2 because 1 < 2.
		

Crossrefs

Cf. A054054.

Programs

  • Haskell
    a054055 = f 0 where
       f m x | x <= 9 = max m x
             | otherwise = f (max m d) x' where (x',d) = divMod x 10
    -- Reinhard Zumkeller, Jun 20 2012, May 14 2011
    
  • Magma
    [n eq 0 select 0 else Maximum(Intseq(n)): n in [0..104]]; // Bruno Berselli, Aug 24 2011
    
  • Maple
    [seq(max(convert(n,base,10)),n=0..120)];
  • Mathematica
    f[n_] := Sort[IntegerDigits[n]][[-1]]; Array[f, 105, 0] (* Alonso del Arte, May 14 2011 *) (* and revised by Robert G. Wilson v, Aug 24 2011 *)
    Max/@IntegerDigits[Range[0,110]] (* Harvey P. Dale, Apr 17 2016 *)
  • PARI
    a(n)=vecmax(eval(Vec(Str(n)))) \\ Charles R Greathouse IV, Jun 16 2011
    
  • PARI
    a(n)=vecmax(digits(n)) \\ Charles R Greathouse IV, Oct 02 2013
    
  • Python
    def A054055(n): return max(int(d) for d in str(n)) # Chai Wah Wu, Jun 06 2022

A065882 Ultimate modulo 4: right-hand nonzero digit of n when written in base 4.

Original entry on oeis.org

1, 2, 3, 1, 1, 2, 3, 2, 1, 2, 3, 3, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 2, 1, 2, 3, 3, 1, 2, 3, 2, 1, 2, 3, 1, 1, 2, 3, 2, 1, 2, 3, 3, 1, 2, 3, 3, 1, 2, 3, 1, 1, 2, 3, 2, 1, 2, 3, 3, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 2, 1, 2, 3, 3, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 2, 1, 2, 3, 3, 1, 2, 3, 2, 1, 2, 3, 1, 1, 2, 3, 2, 1
Offset: 1

Views

Author

Henry Bottomley, Nov 26 2001

Keywords

Comments

From Bradley Klee, Sep 12 2015: (Start)
In some guise, this sequence is a linear encoding of the three fixed-point half-hex tilings (cf. Baake & Grimm, Frettlöh). Applying a permutation, morphism x -> 123x becomes x -> x123, which has three fixed points. Applying a partition, morphism x -> x123 becomes x ->{{3,2},{x,1}} or
3 2 3 2
3 1 2 1
3 2 3 2 3 2
x -> x 1 -> x 1 1 1 -> etc.,
which is the substitution rule for the half-hex tiling when the numbers 1,2,3 determine the direction of a dissecting diameter inscribed on each hexagon.
(End)

Examples

			a(7)=3 and a(112)=3, since 7 is written in base 4 as 13 and 112 as 1300.
		

References

  • M. Baake and U. Grimm, Aperiodic Order Vol. 1, Cambridge University Press, 2013, page 205.

Crossrefs

In base 2 this is A000012, base 3 A060236 and base 10 A065881.
Defining relations for g.f. similar to A014577.

Programs

  • Maple
    f:= proc(n)
    local x:=n;
       while x mod 4 = 0 do x:= x/4 od:
       x mod 4;
    end proc;
    map(f, [$1..100]); # Robert Israel, Jan 05 2016
  • Mathematica
    Nest[ Flatten[ # /. {1 -> {1, 2, 3, 1}, 2 -> {1, 2, 3, 2}, 3 -> {1, 2, 3, 3}}] &, {1}, 4] (* Robert G. Wilson v, May 07 2005 *)
    b[n_] := CoefficientList[Series[
        With[{f0 = (x + 2 x^2 + 3 x^3)/(1 - x^4)},
         Nest[ (# /. x -> x^4) + f0 &, f0, Ceiling[Log[4, n/3]]]],
    {x, 0, n}], x][[2 ;; -1]]; b[100](* Bradley Klee, Sep 12 2015 *)
    Table[Mod[n/4^IntegerExponent[n, 4], 4], {n, 1, 120}] (* Clark Kimberling, Oct 19 2016 *)
  • PARI
    a(n) = (n/4^valuation(n,4))%4; \\ Joerg Arndt, Sep 13 2015
    
  • Python
    def A065882(n): return (n>>((~n & n-1).bit_length()&-2))&3 # Chai Wah Wu, Aug 21 2023

Formula

If n mod 4 = 0 then a(n) = a(n/4), otherwise a(n) = n mod 4. a(n) = A065883(n) mod 4.
Fixed point of the morphism: 1 ->1231, 2 ->1232, 3 ->1233, starting from a(1) = 1. Sequence read mod 2 gives A035263. a(n) = A007913(n) mod 4. - Philippe Deléham, Mar 28 2004
G.f. g(x) satisfies g(x) = g(x^4) + (x + 2 x^2 + 3 x^3)/(1 - x^4). - Bradley Klee, Sep 12 2015
Showing 1-2 of 2 results.