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.

A134808 Cyclops numbers.

This page as a plain text file.
%I A134808 #48 Jan 05 2021 14:46:55
%S A134808 0,101,102,103,104,105,106,107,108,109,201,202,203,204,205,206,207,
%T A134808 208,209,301,302,303,304,305,306,307,308,309,401,402,403,404,405,406,
%U A134808 407,408,409,501,502,503,504,505,506,507,508,509,601,602,603,604,605,606
%N A134808 Cyclops numbers.
%C A134808 Numbers with middle digit 0, that have only one digit 0, and the total number of digits is odd; the digit 0 represents the eye of a cyclops.
%H A134808 Vincenzo Librandi, <a href="/A134808/b134808.txt">Table of n, a(n) for n = 1..1000</a>
%H A134808 Brady Haran and Simon Pampena, <a href="https://www.youtube.com/watch?v=HPfAnX5blO0">Glitch Primes and Cyclops Numbers</a>, Numberphile video (2015).
%e A134808 109 is a cyclops number because 109 has only one digit 0 and this 0 is the middle digit.
%t A134808 cyclopsQ[n_Integer, b_:10] := Module[{digitList = IntegerDigits[n, b], len, pos0s, flag}, len = Length[digitList]; pos0s = Select[Range[len], digitList[[#]] == 0 &]; flag = OddQ[len] && (Length[pos0s] == 1) && (pos0s == {(len + 1)/2}); Return[flag]]; Select[Range[0,999],cyclopsQ] (* _Alonso del Arte_, Dec 16 2010 *)
%t A134808 Reap[Do[id=IntegerDigits[n];If[Position[id,0]=={{(Length[id]+1)/2}},Sow[n]],{n,0,10^3}]][[2,1]] (* _Zak Seidov_, Dec 17 2010 *)
%t A134808 cycQ[n_]:=Module[{idn=IntegerDigits[n],len=IntegerLength[n]},OddQ[len] && DigitCount[ n,10,0]==1&&idn[[(len+1)/2]]==0]; Join[{0},Select[Range[ 0,700],cycQ]] (* _Harvey P. Dale_, Mar 07 2020 *)
%o A134808 (Sage)
%o A134808 def is_cyclops(n, base=10):
%o A134808     dg = n.digits(base) if n > 0 else [0]
%o A134808     return len(dg) % 2 == 1 and dg[len(dg)//2] == 0 and dg.count(0) == 1
%o A134808 is_A134808 = lambda n: is_cyclops(n)
%o A134808 # _D. S. McNeil_, Dec 17 2010
%o A134808 (PARI) a(n, {base=10}) = my (l=0); my (r=n-1); while (r >= (base-1)^(2*l), r -= (base-1)^(2*l); l++); return (base^(l+1) * ( (base^l-1)/(base-1) + if (base>2, fromdigits(digits(r \ ((base-1)^l), (base-1)), base)) ) + ( (base^l-1)/(base-1) + if (base>2, fromdigits(digits(r % ((base-1)^l), (base-1)), base)))) \\ _Rémy Sigrist_, Apr 29 2017
%o A134808 (Python)
%o A134808 from itertools import product
%o A134808 def cyclops(upto=float('inf'), upton=float('inf')): # generator
%o A134808   yield 0
%o A134808   c, n, half_digits, pow10 = 0, 1, 0, 10
%o A134808   while 100**(half_digits+1) < upto and n < upton:
%o A134808     half_digits += 1
%o A134808     pow10 *= 10
%o A134808     for left in product("123456789", repeat=half_digits):
%o A134808       left_plus_eye = int("".join(left))*pow10
%o A134808       for right in product("123456789", repeat=half_digits):
%o A134808         c, n = left_plus_eye + int("".join(right)), n+1
%o A134808         if c <= upto and n <= upton: yield c
%o A134808 print([c for c in cyclops(upto=606)])
%o A134808 print([c for c in cyclops(upton=52)]) # _Michael S. Branicky_, Jan 05 2021
%Y A134808 Cf. A134809, A138131, A138148, A160717, A182809.
%K A134808 base,easy,nonn
%O A134808 1,2
%A A134808 _Omar E. Pol_, Nov 21 2007