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.

A035335 a(n) = smallest number m such that n appears in decimal expansion of 1/m.

Original entry on oeis.org

6, 4, 3, 7, 2, 6, 7, 7, 11, 10, 9, 8, 23, 7, 19, 6, 17, 49, 21, 5, 19, 31, 13, 29, 4, 19, 29, 7, 17, 13, 19, 31, 3, 23, 17, 19, 27, 26, 23, 25, 17, 7, 23, 29, 22, 26, 17, 29, 51, 2, 29, 17, 26, 22, 18, 23, 7, 17, 47, 23, 21, 16, 19, 17, 23, 6, 49, 19, 13, 17, 7, 29, 19, 47, 29, 13
Offset: 1

Views

Author

Keywords

Examples

			a(13)=23 since 1/23=.04347826086956521739{13}... is the first to contain 13.
1/6=.16666... so a(n)=6 for n=1,6,16,66,166,666,1666,6666, ...
		

Programs

  • Mathematica
    foundQ[n_, m_] := (idn = IntegerDigits[n]; ln = Length[idn]; rdm = Most[ Flatten[ RealDigits[1/m, 10, lm = 2* Length[ Flatten[ RealDigits[1/m]]]]]]; found = False; Do[If[idn === Take[rdm, {k, k+ln-1}], found = True; Break[]], {k, 1, lm-ln+1}]; found); a[n_] := (m = 2; While[ True, If[foundQ[n, m], Break[], m++]]; m); a[n_ /; n > 1 && IntegerQ[ Log[10, n]]] := 10; a[n_ /; n > 1 && Union[ IntegerDigits[n]] == {1}] := 9; Table[a[n], {n, 1, 76}] (* Jean-François Alcover, Oct 24 2011 *)
    Table[Function[r, SelectFirst[Range[2, 10^3], Length@ SequencePosition[ If[Depth@ # == 3, Flatten@ Join[#, Table[Last@ #, Length@ # + Length@ r]], PadRight[#, Length@ # + Length@ r]] &@ First@ RealDigits[1/#], r] > 0 &]]@ IntegerDigits@ n, {n, 120}] (* Michael De Vlieger, May 14 2016, Version 10.1 *)