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.

A137998 Least k such that floor(16^n / 10^k) = 1, 2, 4 or 8 (mod 10), or zero if no such k exists.

Original entry on oeis.org

1, 2, 3, 0, 3, 1, 2, 2, 5, 4, 1, 4, 2, 4, 4, 1, 2, 4, 2, 2, 1, 3, 2, 7, 5, 1, 2, 4, 3, 3, 1, 2, 2, 3, 4, 1, 4, 2, 4, 3, 1, 2, 4, 2, 2, 1, 5, 2, 5, 3, 1, 2, 5, 7, 4, 1, 2, 2, 3, 4, 1, 3, 2, 7, 3, 1, 2, 4, 2, 2, 1, 12, 2, 3, 7, 1, 2, 3, 5, 7, 1, 2, 2, 3, 4, 1, 3, 2, 5, 3, 1, 2, 3, 2, 2, 1, 6, 2, 3, 5, 1, 2, 3, 4, 3
Offset: 1

Views

Author

M. F. Hasler, Mar 26 2008

Keywords

Comments

Equivalent definition: position of least significant decimal digit in 16^n equal to one of {1,2,4,8}, or zero if none of these occur. Since this is the true meaning, the sequence is flagged "base", even if the actual definition does not explicitly refer to a base.
This is related to A071071, i.e., the conjecture by J. Shallit that {1,2,4,8,65536} is a minimal set for powers of 2 written in base 10. This amounts to saying that any power of 2 contains either a digit among {1,2,4,8}, or 65536 as subword (obtained by deleting zero or more digits of the number).
Any power 2^k ends in a digit among {1,2,4,8} except for k=4n, n>0, in which case 2^k=16^n ends in 6.
The present sequence gives the position of the first digit (starting with units) of these powers which is among {1,2,4,8}. It appears as if 16^4=65536 is the only power of 2 which does not contain any of these four digits. This would imply the conjecture (and be an even stronger statement).
The sequence has a repeating pattern of length 25 of the form
( 1 2 A B C 1 2 2 D E 1 F 2 G H 1 2 J 2 2 1 K 2 L M )... where A-M follow again a repeating pattern:
A=(3,p,q,3,3)... ; C=(3,3,r,s,3)...; D=(t,3,3,3,u)...; etc.

Examples

			a(1)=1 since 16^1 has a 1 in position 1 (10^1).
a(2)=2 since 16^2=256 has a 2 in position 2 (10^2).
a(3)=3 since 16^3=4096 has a 4 in position 3 (10^3).
a(4)=0 since 16^4=65536 has no digit 1,2,4 or 8.
If we arrange the terms in a 25-column matrix, we can see the pattern:
[1 2 3 0 3 1 2 2 5 4 1 4 2 4 4 1 2 4 2 2 1  3 2 7 5]
[1 2 4 3 3 1 2 2 3 4 1 4 2 4 3 1 2 4 2 2 1  5 2 5 3]
[1 2 5 7 4 1 2 2 3 4 1 3 2 7 3 1 2 4 2 2 1 12 2 3 7]
[1 2 3 5 7 1 2 2 3 4 1 3 2 5 3 1 2 3 2 2 1  6 2 3 5]
[1 2 3 4 3 1 2 2 5 3 1 3 2 3 8 1 2 5 2 2 1  4 2 3 4]
[1 2 3 4 3 1 2 2 6 5 1 6 2 5 4 1 2 5 2 2 1  3 2 5 4]
[1 2 7 3 3 1 2 2 3 7 1 8 2 7 3 1 2 5 2 2 1  7 2 4 3]
[1 2 4 5 4 1 2 2 3 7 1 3 2 4 3 1 2 4 2 2 1  4 2 3 5]
[1 2 3 4 4 1 2 2 3 7 1 3 2 6 3 1 2 3 2 2 1  4 2 3 8]
[1 2 3 5 3 1 2 2 4 3 1 3 2 3 4 1 2 6 2 2 1  5 2 3 6]
[1 2 3 4 3 1 2 2 9 4 1 5 2 4 5 1 2 8 2 2 1  3 2 4 5] etc.
		

Crossrefs

Cf. A071071.

Programs

  • PARI
    A137998(n,S=Vec("1248"))={ forstep( i=#n=Vec(Str(16^n)),1,-1, setsearch(S,n[i]) & return( #n-i ))}
    
  • PARI
    t=0;matrix(25,20/*# of rows*/,i,j,A137998(t++))~