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.

A145649 Characteristic function of the lucky numbers.

Original entry on oeis.org

1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 15 2008

Keywords

Comments

Is there an efficient formula for this sequence? To wit, is there an algorithm for determining whether n is a lucky or unlucky number which is substantially faster than determining the lucky numbers up to n? - Charles R Greathouse IV, Nov 24 2021

Crossrefs

Cf. A000959 (lucky numbers), A050505 (complement: unlucky numbers).
See also A010051, A192490.

Programs

  • Mathematica
    luckies = 2 Range[0, 100] + 1;
    Module[{k, r}, For[k = 2, k Nothing, {i, 1, Length[luckies]/r}]]]];
    a[n_ /; 1 <= n <= Last[luckies]] := Boole[MemberQ[luckies, n]];
    Table[a[n], {n, 1, Last[luckies]}] (* Jean-François Alcover, Oct 18 2021, after Robert Israel in A000959 *)
  • PARI
    A145649list(up_to) = { my(u=A000959_upto(up_to), v=vector(up_to)); for(i=1,#u,v[u[i]] = 1); (v); }; \\ See there for A000959_upto(). - Antti Karttunen, Sep 27 2019

Formula

a(A000959(n)) = 1, a(A050505(n)) = 0.