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-10 of 15 results. Next

A171923 Records in A031883 (values).

Original entry on oeis.org

2, 4, 6, 12, 18, 24, 30, 52, 64, 66, 68, 100, 108, 112, 144, 158, 160, 162, 182, 194, 218, 226, 228, 230, 244, 264, 266, 288, 290, 312
Offset: 1

Views

Author

R. J. Mathar, Oct 23 2010

Keywords

Crossrefs

Formula

a(n) = A031883(A171924(n)) . [From R. J. Mathar, Oct 24 2010]

Extensions

a(16)-a(30) from Donovan Johnson, Oct 24 2010

A171924 Records in A031883 (positions).

Original entry on oeis.org

1, 2, 6, 14, 36, 122, 162, 450, 2364, 4760, 4818, 8541, 19570, 44514, 47448, 114885, 378956, 384324, 542246, 1275572, 1385164, 3865640, 4514352, 5226312, 6271502, 12817002, 18665964, 19815336, 33506604, 42712210
Offset: 1

Views

Author

R. J. Mathar, Oct 23 2010

Keywords

Crossrefs

Extensions

a(16)-a(30) from Donovan Johnson, Oct 24 2010

A181557 Indices k for which A031883(k) = 2 = A000959(k+1)-A000959(k), i.e., indices of (lesser) "twin" lucky numbers.

Original entry on oeis.org

1, 3, 5, 9, 13, 16, 18, 27, 29, 35, 38, 46, 49, 53, 59, 69, 75, 80, 83, 87, 90, 95, 100, 102, 106, 117, 120, 136, 138, 141, 143, 149, 151, 154, 156, 159, 164, 167, 178, 182, 185, 187, 201, 205, 211, 215, 217, 221, 227, 229, 232, 246, 248, 256, 265, 271, 283, 286
Offset: 1

Views

Author

M. F. Hasler, Oct 31 2010

Keywords

Crossrefs

A118126 Lucky numbers (A000959) at which records in first differences (A031883) occur.

Original entry on oeis.org

1, 3, 15, 51, 171, 745, 1057, 3507, 23205, 50779, 51475, 97113, 241887, 593727, 636291, 1661215, 6010095, 6100953, 8825911, 22032619, 24058237, 71730273, 84577003, 98797723, 119871675, 255510487, 380154649, 404917765, 704823889, 910302427, 1696449051, 2565189555, 9024827079
Offset: 1

Views

Author

Robert G. Wilson v, May 12 2006

Keywords

Comments

An increasing subset of sequence A031884.

Examples

			a(4) = 51 since the 4th record value in the lucky number "first differences" sequence occurs A031883(14) = 12 which corresponds to lucky number A000959(14) = 51.
		

Crossrefs

Programs

  • Mathematica
    lst = Range[1, 10^6, 2]; i = 2; While[ i <= (len = Length@lst) && (k = lst[[i]]) <= len, lst = Drop[lst, {k, len, k}]; i++ ]; lst2 = {}; d = 0; Do[a = t[[n + 1]] - t[[n]]; If[a > d, d = a; AppendTo[lst, t[[n]]]], {n, 5286237}]; lst2

Extensions

a(25)-a(29) from Donovan Johnson, Oct 23 2010
a(30) from Donovan Johnson, Jun 20 2011
a(31)-a(33) from Kevin P. Thompson, Nov 24 2021

A181558 Index of first occurrence of 2n in A031883, or 0 if 2n never occurs in A031883 = first differences of lucky numbers A000959.

Original entry on oeis.org

1, 2, 6, 20, 31, 14, 126, 85, 36, 145, 140, 122, 376, 231, 162, 483, 692, 600, 993, 1188, 1106, 2440, 1080, 2814, 2586, 450, 2696, 3473, 4254, 4857, 5918, 2364, 4760, 4818, 21192, 13116, 19284, 14855, 12158, 31032, 18174, 15068, 35700, 56846, 27367, 33716, 13736, 16746, 103292, 8541
Offset: 1

Views

Author

M. F. Hasler, Oct 31 2010

Keywords

Examples

			a(1)=1 is the least index i such that A000959(i)+2*1 = A000959(i+1), since A000959(1) = 1 and A000959(2) = 3.
a(2)=2 is the least index i such that A000959(i)+2*2 = A000959(i+1), since A000959(2) = 3 and A000959(3) = 7.
a(3)=6 is the least index i such that A000959(i)+2*3 = A000959(i+1); indeed A000959(7) - A000959(6) = 21 - 15 is the earliest gap of 6 in A000959.
		

Crossrefs

Cf. A038664 (analog for primes).

Programs

  • PARI
    a(n) = for( i=1,1e9, A031883[i]==2*n & return(i)) /* will issue an error if 2n is not found in A031883 */

Formula

a(n) = min { k | A031883(k)=2n } = min { k | A000959(k+1)=A000959(k)+2n }.

Extensions

a(20)-a(50) from Nathaniel Johnston, Nov 15 2010

A000959 Lucky numbers.

Original entry on oeis.org

1, 3, 7, 9, 13, 15, 21, 25, 31, 33, 37, 43, 49, 51, 63, 67, 69, 73, 75, 79, 87, 93, 99, 105, 111, 115, 127, 129, 133, 135, 141, 151, 159, 163, 169, 171, 189, 193, 195, 201, 205, 211, 219, 223, 231, 235, 237, 241, 259, 261, 267, 273, 283, 285, 289, 297, 303
Offset: 1

Views

Author

N. J. A. Sloane; entry updated Mar 07 2008

Keywords

Comments

An interesting general discussion of the phenomenon of 'random primes' (generalizing the lucky numbers) occurs in Hawkins (1958). Heyde (1978) proves that Hawkins' random primes do not only almost always satisfy the Prime Number Theorem but also the Riemann Hypothesis. - Alf van der Poorten, Jun 27 2002
Bui and Keating establish an asymptotic formula for the number of k-difference twin primes, and more generally to all l-tuples, of Hawkins primes, a probabilistic model of the Eratosthenes sieve. The formula for k = 1 was obtained by Wunderlich [Acta Arith. 26 (1974), 59 - 81]. - Jonathan Vos Post, Mar 24 2009. (This is quoted from the abstract of the Bui-Keating (2006) article, Joerg Arndt, Jan 04 2014)
It appears that a 1's line is formed, as in the Gilbreath's conjecture, if we use 2 (or 4), 3, 5 (differ of 7), 9, 13, 15, 21, 25, ... instead of A000959 1, 3, 7, 9, 13, 15, 21, 25, ... - Eric Desbiaux, Mar 25 2010
The Mersenne primes 2^p - 1 (= A000668, p in A000043) are in this sequence for p = 2, 3, 5, 7, 13, 17, and 19, but not for the following exponents p = 31, 61, and 89. - M. F. Hasler, May 06 2025

References

  • Martin Gardner, Gardner's Workout, Chapter 21 "Lucky Numbers and 2187" pp. 149-156 A. K. Peters MA 2002.
  • Richard K. Guy, Unsolved Problems in Number Theory, C3.
  • C. S. Ogilvy, Tomorrow's Math. 2nd ed., Oxford Univ. Press, 1972, p. 99.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • M. L. Stein and P. R. Stein, Tables of the Number of Binary Decompositions of All Even Numbers Less Than 200,000 into Prime Numbers and Lucky Numbers. Report LA-3106, Los Alamos Scientific Laboratory of the University of California, Los Alamos, NM, Sep 1964.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 116.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, 114.

Crossrefs

Main diagonal of A258207.
Column 1 of A255545. (cf. also arrays A255543, A255551).
Cf. A050505 (complement).
Cf. A145649 (characteristic function).
Cf. A031883 (first differences), A254967 (iterated absolute differences), see also A054978.
Cf. A109497 (works as a left inverse function).
The Gilbreath transform is A054978 - see also A362460, A362461, A362462.

Programs

  • Haskell
    a000959 n = a000959_list !! (n-1)
    a000959_list =  1 : sieve 2 [1,3..] where
       sieve k xs = z : sieve (k + 1) (lucky xs) where
          z = xs !! (k - 1 )
          lucky ws = us ++ lucky vs where
                (us, _:vs) = splitAt (z - 1) ws
    -- Reinhard Zumkeller, Dec 05 2011
    
  • Haskell
    -- Also see links.
    (C++) // See Wilson link, Nov 14 2012
    
  • Maple
    ## luckynumbers(n) returns all lucky numbers from 1 to n. ## Try n=10^5 just for fun. luckynumbers:=proc(n) local k, Lnext, Lprev; Lprev:=[$1..n]; for k from 1 do if k=1 or k=2 then Lnext:= map(w-> Lprev[w],remove(z -> z mod Lprev[2] = 0,[$1..nops(Lprev)])); if nops(Lnext)=nops(Lprev) then break fi; Lprev:=Lnext; else Lnext:= map(w-> Lprev[w],remove(z -> z mod Lprev[k] = 0,[$1..nops(Lprev)])); if nops(Lnext)=nops(Lprev) then break fi; Lprev:=Lnext; fi; od; return Lnext; end: # Walter Kehowski, Jun 05 2008; typo fixed by Robert Israel, Nov 19 2014
    # Alternative
    A000959List := proc(mx) local i, L, n, r;
    L:= [seq(2*i+1, i=0..mx)]:
    for n from 2 while n < nops(L) do
      r:= L[n];
      L:= subsop(seq(r*i=NULL, i=1..nops(L)/r), L);
    od: L end:
    A000959List(10^3); # Robert Israel, Nov 19 2014
  • Mathematica
    luckies = 2*Range@200 - 1; f[n_] := Block[{k = luckies[[n]]}, luckies = Delete[luckies, Table[{k}, {k, k, Length@luckies, k}]]]; Do[f@n, {n, 2, 30}]; luckies (* Robert G. Wilson v, May 09 2006 *)
    sieveMax = 10^6; luckies = Range[1, sieveMax, 2]; sieve[n_] := Module[{k = luckies[[n]]}, luckies = Delete[luckies, Table[{i}, {i, k, Length[luckies], k}]]]; n = 1; While[luckies[[n]] < Length[luckies], n++; sieve[n]]; luckies
    L = Table[2*i + 1, {i, 0, 10^3}]; For[n = 2, n < Length[L], r = L[[n++]]; L = ReplacePart[L, Table[r*i -> Nothing, {i, 1, Length[L]/r}]]]; L (* Jean-François Alcover, Mar 15 2016, after Robert Israel *)
  • PARI
    A000959_upto(nMax)={my(v=vectorsmall(nMax\2,k,2*k-1),i=1,q);while(v[i++]<=#v,v=vecextract(v,2^#v-1-(q=1<M. F. Hasler, Sep 22 2013, improved Jan 20 2020
    
  • Python
    def lucky(n):
        L = list(range(1, n + 1, 2))
        j = 1
        while j <= len(L) - 1 and L[j] <= len(L):
            del L[L[j]-1::L[j]]
            j += 1
        return L
    # Robert FERREOL, Nov 19 2014, corrected by F. Chapoton, Mar 29 2020, performance improved by Ely Golden, Aug 18 2022
    
  • Scheme
    (define (A000959 n) ((rowfun_n_for_A000959sieve n) n)) ;; Code for rowfun_n_for_A000959sieve given in A255543.
    ;; Antti Karttunen, Feb 26 2015

Formula

Start with the natural numbers. Delete every 2nd number, leaving 1 3 5 7 ...; the 2nd number remaining is 3, so delete every 3rd number, leaving 1 3 7 9 13 15 ...; now delete every 7th number, leaving 1 3 7 9 13 ...; now delete every 9th number; etc.
a(n) = A254967(n-1, n-1). - Reinhard Zumkeller, Feb 11 2015
a(n) = A258207(n,n). [Where A258207 is a square array constructed from the numbers remaining after each step described above.] - Antti Karttunen, Aug 06 2015
A145649(a(n)) = 1; complement of A050505. - Reinhard Zumkeller, Oct 15 2008
Other identities from Antti Karttunen, Feb 26 2015: (Start)
For all n >= 1, A109497(a(n)) = n.
For all n >= 1, a(n) = A000040(n) + A032600(n).
For all n >= 2, a(n) = A255553(A000040(n)). (End)

A260723 First differences of Ludic numbers: a(n) = A003309(n+1) - A003309(n).

Original entry on oeis.org

1, 1, 2, 2, 4, 2, 4, 6, 2, 4, 8, 4, 2, 4, 6, 8, 6, 4, 6, 6, 6, 2, 6, 10, 8, 4, 2, 6, 4, 12, 6, 8, 4, 12, 2, 4, 2, 12, 16, 2, 10, 2, 4, 6, 2, 4, 8, 10, 8, 12, 6, 4, 14, 6, 6, 16, 2, 6, 4, 12, 6, 2, 16, 6, 6, 8, 10, 8, 4, 2, 10, 2, 4, 8, 18, 4, 8, 6, 12, 4, 6, 6, 8, 10, 8, 6, 12, 12, 12, 4, 12, 2, 12, 6, 4, 8, 18, 4, 6, 6, 8, 6, 12, 6, 6, 6, 4, 20, 6
Offset: 1

Views

Author

Antti Karttunen, Aug 06 2015

Keywords

Crossrefs

Cf. A003309.
Cf. also A001223, A031883, A260722.

Programs

Formula

a(n) = A003309(n+1) - A003309(n).

A130889 a(n) = smallest k such that A000959(n+1) = A000959(n) + (A000959(n) mod k), or 0 if no such k exists.

Original entry on oeis.org

0, 0, 5, 5, 11, 9, 17, 19, 29, 29, 31, 37, 47, 13, 59, 5, 5, 71, 71, 71, 9, 29, 31, 9, 107, 103, 5, 5, 131, 43, 131, 11, 5, 157, 167, 51, 5, 191, 7, 197, 199, 29, 5, 43, 227, 233, 233, 223, 257, 15, 9, 263, 281, 281, 281, 97, 13, 59, 317, 7, 17, 17, 47, 11, 353, 71, 349, 379, 389
Offset: 1

Views

Author

Rémi Eismann, Aug 21 2007 - Jan 23 2011

Keywords

Comments

a(n) is the "weight" of lucky numbers.
The decomposition of lucky numbers into weight * level + gap is A000959(n) = a(n) * A184828(n) + A031883(n) if a(n) > 0.

Examples

			For n = 1 we have A000959(n) = 1, A000959(n+1) = 3; there is no k such that 3 - 1 = 2 = (1 mod k), hence a(1) = 0.
For n = 3 we have A000959(n) = 7, A000959(n+1) = 9; 5 is the smallest k such that 9 - 7 = 2 = (7 mod k), hence a(3) = 5.
For n = 24 we have A000959(n) = 105, A000959(n+1) = 111; 9 is the smallest k such that 111 - 105 = 6 = (105 mod k), hence a(24) = 9.
		

Crossrefs

A254967 Triangle of iterated absolute differences of lucky numbers read by antidiagonals upwards.

Original entry on oeis.org

1, 2, 3, 2, 4, 7, 0, 2, 2, 9, 0, 0, 2, 4, 13, 0, 0, 0, 2, 2, 15, 2, 2, 2, 2, 4, 6, 21, 2, 0, 2, 0, 2, 2, 4, 25, 2, 0, 0, 2, 2, 0, 2, 6, 31, 0, 2, 2, 2, 0, 2, 2, 4, 2, 33, 0, 0, 2, 0, 2, 2, 0, 2, 2, 4, 37, 0, 0, 0, 2, 2, 0, 2, 2, 0, 2, 6, 43, 2, 2, 2, 2, 0, 2
Offset: 0

Views

Author

Reinhard Zumkeller, Feb 11 2015

Keywords

Comments

This sequence is related to the lucky numbers (cf. A000959) in the same way as A036262 is related to the prime numbers;

Examples

			.   0:                      1
.   1:                     2 3
.   2:                    2 4 7
.   3:                   0 2 2 9
.   4:                  0 0 2 4 13
.   5:                 0 0 0 2 2 15
.   6:                2 2 2 2 4 6 21
.   7:               2 0 2 0 2 2 4 25
.   8:              2 0 0 2 2 0 2 6 31
.   9:             0 2 2 2 0 2 2 4 2 33
.  10:            0 0 2 0 2 2 0 2 2 4 37
.  11:           0 0 0 2 2 0 2 2 0 2 6 43
.  12:          2 2 2 2 0 2 2 0 2 2 0 6 49
.  13:         0 2 0 2 0 0 2 0 0 2 4 4 2 51 .
		

Crossrefs

Cf. A054978 (left edge), A254969 (central terms), A000959 (right edge), A031883, A036262.

Programs

  • Haskell
    a254967 n k = a254967_tabl !! n !! k
    a254967_row n = a254967_tabl !! n
    a254967_tabl = diags [] $
       iterate (\lds -> map abs $ zipWith (-) (tail lds) lds) a000959_list
       where diags uss (vs:vss) = (map head wss) : diags (map tail wss) vss
                                  where wss = vs : uss
  • Mathematica
    nmax = 13; (* max index for triangle rows *)
    imax = 25; (* max index for initial lucky array L *)
    L = Table[2i + 1, {i, 0, imax}];
    For[n = 2, n < Length[L], r = L[[n++]]; L = ReplacePart[L, Table[r*i -> Nothing, {i, 1, Length[L]/r}]]];
    T[n_, n_] := If[n+1 <= Length[L], L[[n+1]], Print["imax should be increased"]; 0];
    T[n_, k_] := T[n, k] = Abs[T[n, k+1] - T[n-1, k]];
    Table[T[n, k], {n, 0, nmax}, {k, 0, n}] // Flatten (* Jean-François Alcover, Sep 22 2021 *)

Formula

T(n,0) = A054978(n).
T(2*n,n) = A254969(n).
T(n,n-1) = A031883(n) for n > 0.
T(n,n) = A000959(n+1).
T(n,k) = abs(T(n,k+1) - T(n-1,k)) for 0 <= k < n.

A350001 Iterated differences of lucky numbers. Array read by antidiagonals, n >= 0, k >= 1: T(0,k) = A000959(k), T(n,k) = T(n-1,k+1) - T(n-1,k) for n > 0.

Original entry on oeis.org

1, 3, 2, 7, 4, 2, 9, 2, -2, -4, 13, 4, 2, 4, 8, 15, 2, -2, -4, -8, -16, 21, 6, 4, 6, 10, 18, 34, 25, 4, -2, -6, -12, -22, -40, -74, 31, 6, 2, 4, 10, 22, 44, 84, 158, 33, 2, -4, -6, -10, -20, -42, -86, -170, -328, 37, 4, 2, 6, 12, 22, 42, 84, 170, 340, 668
Offset: 0

Views

Author

Pontus von Brömssen, Dec 08 2021

Keywords

Examples

			Array begins:
  n\k|    1    2    3    4    5    6    7     8    9    10   11   12
  ---+--------------------------------------------------------------
   0 |    1    3    7    9   13   15   21    25   31    33   37   43
   1 |    2    4    2    4    2    6    4     6    2     4    6    6
   2 |    2   -2    2   -2    4   -2    2    -4    2     2    0   -4
   3 |   -4    4   -4    6   -6    4   -6     6    0    -2   -4   14
   4 |    8   -8   10  -12   10  -10   12    -6   -2    -2   18  -32
   5 |  -16   18  -22   22  -20   22  -18     4    0    20  -50   56
   6 |   34  -40   44  -42   42  -40   22    -4   20   -70  106  -82
   7 |  -74   84  -86   84  -82   62  -26    24  -90   176 -188  102
   8 |  158 -170  170 -166  144  -88   50  -114  266  -364  290 -100
   9 | -328  340 -336  310 -232  138 -164   380 -630   654 -390   50
  10 |  668 -676  646 -542  370 -302  544 -1010 1284 -1044  440   78
		

Crossrefs

Cf. A000959 (row n = 0), A031883 (row n = 1), A123593 (column k = 1).
Cf. A254967 (absolute differences), A095195 (iterated differences of primes), A350004 (iterated differences of ludic numbers).

Formula

T(n,k) = Sum_{j=0..n} (-1)^(n-j)*binomial(n,j)*A000959(k+j).
Showing 1-10 of 15 results. Next