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 16 results. Next

A256487 a(n) = A254100(n) - A219178(n).

Original entry on oeis.org

2, 4, 0, 4, 10, 18, 16, 36, 28, 48, 78, 80, 62, 90, 76, 110, 134, 158, 200, 220, 224, 216, 236, 280, 308, 312, 262, 314, 328, 402, 430, 424, 438, 488, 506, 538, 414, 510, 642, 620, 680, 648, 656, 690, 666, 684, 730, 790, 742, 840, 844, 862, 916, 976, 1004, 1092, 1072, 1112, 1054, 1166, 1176, 1184, 1292
Offset: 1

Views

Author

Antti Karttunen, May 01 2015

Keywords

Comments

Difference between the least nonludic number removed at the n-th stage of Ludic sieve and the least unlucky number removed at the n-th stage of Lucky sieve.

Crossrefs

Cf. A219178, A254100, A256482, A256486, A256488 (same terms divided by 2).

Programs

Formula

a(n) = A254100(n) - A219178(n).

A256488 a(n) = A256487(n)/2 = (A254100(n) - A219178(n))/2.

Original entry on oeis.org

1, 2, 0, 2, 5, 9, 8, 18, 14, 24, 39, 40, 31, 45, 38, 55, 67, 79, 100, 110, 112, 108, 118, 140, 154, 156, 131, 157, 164, 201, 215, 212, 219, 244, 253, 269, 207, 255, 321, 310, 340, 324, 328, 345, 333, 342, 365, 395, 371, 420, 422, 431, 458, 488, 502, 546, 536, 556, 527, 583, 588, 592, 646, 643, 639, 665, 688, 662, 662
Offset: 1

Views

Author

Antti Karttunen, May 01 2015

Keywords

Comments

Half the difference between the least nonludic number removed at the n-th stage of Ludic sieve and the least unlucky number removed at the n-th stage of Lucky sieve.

Crossrefs

Programs

Formula

a(n) = A256487(n)/2 = (A254100(n) - A219178(n))/2.

A257256 Difference between {the first unlucky number removed at the n-th stage of Lucky sieve} and {the n-th Lucky number}: a(n) = A219178(n) - A000959(n).

Original entry on oeis.org

1, 2, 12, 18, 32, 40, 64, 84, 108, 124, 138, 170, 206, 214, 274, 296, 318, 338, 348, 378, 426, 454, 498, 532, 564, 600, 662, 678, 710, 736, 766, 836, 874, 920, 944, 954, 1078, 1104, 1120, 1170, 1202, 1254, 1296, 1332, 1378, 1416, 1434, 1466, 1592, 1612, 1660, 1696, 1778, 1786, 1820, 1888, 1932, 1952, 2058
Offset: 1

Views

Author

Antti Karttunen, Apr 29 2015

Keywords

Crossrefs

First column of A257255.

Programs

Formula

a(n) = A219178(n) - A000959(n).

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)

A255543 Unlucky array: Row n consists of unlucky numbers removed at the stage n of Lucky sieve.

Original entry on oeis.org

2, 4, 5, 6, 11, 19, 8, 17, 39, 27, 10, 23, 61, 57, 45, 12, 29, 81, 91, 97, 55, 14, 35, 103, 121, 147, 117, 85, 16, 41, 123, 153, 199, 181, 177, 109, 18, 47, 145, 183, 253, 243, 277, 225, 139, 20, 53, 165, 217, 301, 315, 369, 345, 295, 157, 22, 59, 187, 247, 351, 379, 471, 465, 447, 325, 175, 24, 65, 207, 279, 403, 441, 567, 589, 603, 493, 381, 213
Offset: 1

Views

Author

Antti Karttunen, Feb 25 2015

Keywords

Comments

The array A(row,col) is read by antidiagonals A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), ...

Examples

			Top left corner of the square array:
    2,   4,   6,   8,  10,  12,   14,   16,   18,   20,  22,    24,   26,   28,   30
    5,  11,  17,  23,  29,  35,   41,   47,   53,   59,  65,    71,   77,   83,   89
   19,  39,  61,  81, 103, 123,  145,  165,  187,  207, 229,   249,  271,  291,  313
   27,  57,  91, 121, 153, 183,  217,  247,  279,  309, 343,   373,  405,  435,  469
   45,  97, 147, 199, 253, 301,  351,  403,  453,  507, 555,   609,  661,  709,  763
   55, 117, 181, 243, 315, 379,  441,  505,  571,  633, 697,   759,  825,  889,  951
   85, 177, 277, 369, 471, 567,  663,  757,  853,  949, 1045, 1141, 1239, 1333, 1431
  109, 225, 345, 465, 589, 705,  829,  945, 1063, 1185, 1305, 1423, 1549, 1669, 1789
  139, 295, 447, 603, 765, 913, 1075, 1227, 1377, 1537, 1689, 1843, 1999, 2155, 2313
  157, 325, 493, 667, 835, 999, 1177, 1347, 1513, 1687, 1861, 2029, 2205, 2367, 2535
...
		

Crossrefs

Permutation of A050505.
Row 1: A005843 (after zero), Row 2: A016969.
Column 1: A219178.
Main diagonal: A255549. The first subdiagonal: A255550 (apart from the initial term).
Transpose: A255544.
This is array A255545 without its leftmost column, A000959.
Cf. also arrays A255127 and A255551.

Programs

  • Mathematica
    rows = cols = 12; L = 2 Range[0, 2000] + 1; A = Join[{2 Range[cols]}, Reap[For[n = 2, n <= rows, r = L[[n++]]; L0 = L; L = ReplacePart[L, Table[r i -> Nothing, {i, 1, Length[L]/r}]]; Sow[Complement[L0, L][[1 ;; cols]]]]][[2, 1]]]; Table[A[[n - k + 1, k]], {n, 1, Min[rows, cols]}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Mar 15 2016 *)
  • Scheme
    (define (A255543 n) (A255543bi (A002260 n) (A004736 n)))
    (define (A255543bi row col) ((rowfun_n_for_A255543 row) col))
    ;; Uses the memoizing definec-macro:
    (definec (rowfun_n_for_A255543 n) (if (= 1 n) (lambda (n) (+ n n)) (let* ((rowfun_for_remaining (rowfun_n_for_A000959sieve (- n 1))) (eka (A000959 n))) (compose rowfun_for_remaining (lambda (n) (* eka n))))))
    (definec (rowfun_n_for_A000959sieve n) (if (= 1 n) A005408shifted (let* ((prevrowfun (rowfun_n_for_A000959sieve (- n 1))) (everynth (prevrowfun n))) (compose-funs prevrowfun (nonzero-pos 1 1 (lambda (i) (modulo i everynth)))))))
    (definec (A000959 n) ((rowfun_n_for_A000959sieve n) n))
    (define (A005408shifted n) (- (* 2 n) 1))

A254100 Postludic numbers: Second column of Ludic array A255127.

Original entry on oeis.org

4, 9, 19, 31, 55, 73, 101, 145, 167, 205, 253, 293, 317, 355, 413, 473, 521, 569, 623, 677, 737, 763, 833, 917, 983, 1027, 1051, 1121, 1171, 1273, 1337, 1411, 1471, 1571, 1619, 1663, 1681, 1807, 1957, 1991, 2087, 2113, 2171, 2245, 2275, 2335, 2401, 2497, 2593, 2713, 2771, 2831, 2977, 3047, 3113
Offset: 1

Views

Author

Antti Karttunen, Feb 22 2015

Keywords

Crossrefs

Column 2 of A255127. (Row 2 of A255129). Positions of 2's in A260739.
Subsequence of A192607, A302036 and A302038.
Cf. A276576, A276606 (first differences).
Cf. also A001248, A219178.

Programs

  • Mathematica
    rows = 100; cols = 2; t = Range[2, 10^4]; r = {1}; n = 1; While[n <= rows, k = First[t]; AppendTo[r, k]; t0 = t; t = Drop[t, {1, -1, k}]; ro[n++] = Complement[t0, t][[1 ;; cols]]]; A = Array[ro, rows]; Table[A[[n, 2]], {n, 1, rows} ] (* Jean-François Alcover, Mar 14 2016, after Ray Chandler *)
  • Scheme
    (define (A254100 n) (A255127bi n 2)) ;; A255127bi given in A255127.

Formula

a(n) = A255407(A001248(n)).

A255545 Lucky / Unlucky array: Each row starts with n-th lucky number, followed by all unlucky numbers removed at stage n of the sieve.

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 6, 11, 19, 9, 8, 17, 39, 27, 13, 10, 23, 61, 57, 45, 15, 12, 29, 81, 91, 97, 55, 21, 14, 35, 103, 121, 147, 117, 85, 25, 16, 41, 123, 153, 199, 181, 177, 109, 31, 18, 47, 145, 183, 253, 243, 277, 225, 139, 33, 20, 53, 165, 217, 301, 315, 369, 345, 295, 157, 37, 22, 59, 187, 247, 351, 379, 471, 465, 447, 325, 175, 43
Offset: 1

Views

Author

Antti Karttunen, Feb 25 2015

Keywords

Comments

The array A(row,col) is read by antidiagonals A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), ...

Examples

			The top left corner of the array:
   1,   2,   4,   6,   8,  10,  12,   14,   16,   18,   20,   22,   24,   26,   28
   3,   5,  11,  17,  23,  29,  35,   41,   47,   53,   59,   65,   71,   77,   83
   7,  19,  39,  61,  81, 103, 123,  145,  165,  187,  207,  229,  249,  271,  291
   9,  27,  57,  91, 121, 153, 183,  217,  247,  279,  309,  343,  373,  405,  435
  13,  45,  97, 147, 199, 253, 301,  351,  403,  453,  507,  555,  609,  661,  709
  15,  55, 117, 181, 243, 315, 379,  441,  505,  571,  633,  697,  759,  825,  889
  21,  85, 177, 277, 369, 471, 567,  663,  757,  853,  949, 1045, 1141, 1239, 1333
  25, 109, 225, 345, 465, 589, 705,  829,  945, 1063, 1185, 1305, 1423, 1549, 1669
  31, 139, 295, 447, 603, 765, 913, 1075, 1227, 1377, 1537, 1689, 1843, 1999, 2155
  33, 157, 325, 493, 667, 835, 999, 1177, 1347, 1513, 1687, 1861, 2029, 2205, 2367
...
		

Crossrefs

Inverse: A255546.
Transpose: A255547.
Column 1: A000959. Other columns of array as in A255543, e.g. column 2: A219178.
Row 1: A004275 (starting from 1).
See A255551 for a slightly different variant.

Programs

Formula

For col = 1, A(row,col) = A000959(row); otherwise, A(row,col) = A255543(row,col-1).

A260438 Row index to A255545: If n is k-th Lucky number then a(n) = k, otherwise a(n) = number of the stage where n is removed in Lucky sieve.

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 3, 1, 4, 1, 2, 1, 5, 1, 6, 1, 2, 1, 3, 1, 7, 1, 2, 1, 8, 1, 4, 1, 2, 1, 9, 1, 10, 1, 2, 1, 11, 1, 3, 1, 2, 1, 12, 1, 5, 1, 2, 1, 13, 1, 14, 1, 2, 1, 6, 1, 4, 1, 2, 1, 3, 1, 15, 1, 2, 1, 16, 1, 17, 1, 2, 1, 18, 1, 19, 1, 2, 1, 20, 1, 3, 1, 2, 1, 7, 1, 21, 1, 2, 1, 4, 1, 22, 1, 2, 1, 5, 1, 23, 1, 2, 1, 3, 1, 24, 1, 2, 1, 8, 1, 25, 1, 2, 1, 26, 1, 6, 1, 2, 1
Offset: 1

Views

Author

Antti Karttunen, Jul 29 2015

Keywords

Comments

For n >= 2 this works also as a row index to array A255551 (which does not contain 1) and when restricted to unlucky numbers, A050505, also as a row index to array A255543.

Crossrefs

Cf. also A260429, A260439 (corresponding column indices).
Cf. A055396, A260738 for row indices to other arrays similar to A255545.

Programs

  • Scheme
    (define (A260438 n) (cond ((not (zero? (A145649 n))) (A109497 n)) ((even? n) 1) (else (let searchrow ((row 2)) (let searchcol ((col 1)) (cond ((>= (A255543bi row col) n) (if (= (A255543bi row col) n) row (searchrow (+ 1 row)))) (else (searchcol (+ 1 col))))))))) ;; Code for A255543bi given in A255543.

Formula

Other identities. For all n >= 1:
a(A000959(n)) = n.
a(A219178(n)) = n.
a(2n) = 1. [All even numbers are removed at the stage one of the sieve.]
a(A016969(n)) = 2.
a(A258016(n)) = 3.
a(A260440(n)) = 4.
A255545(a(n), A260429(n)) = n.
For all n >= 2, A255551(a(n), A260439(n)) = n.

A255553 Permutation of natural numbers: a(n) = A255551(A252460(n)).

Original entry on oeis.org

1, 2, 3, 4, 7, 6, 9, 8, 5, 10, 13, 12, 15, 14, 11, 16, 21, 18, 25, 20, 17, 22, 31, 24, 19, 26, 23, 28, 33, 30, 37, 32, 29, 34, 39, 36, 43, 38, 35, 40, 49, 42, 51, 44, 41, 46, 63, 48, 27, 50, 47, 52, 67, 54, 61, 56, 53, 58, 69, 60, 73, 62, 59, 64, 81, 66, 75, 68, 65, 70, 79, 72, 87, 74, 71, 76, 57, 78, 93, 80, 77, 82, 99, 84, 103, 86, 83, 88, 105, 90
Offset: 1

Views

Author

Antti Karttunen, Feb 26 2015

Keywords

Comments

a(n) tells which number in array A255551, constructed from Lucky sieve, is at the same position where n is in array A083221, constructed from the sieve of Eratosthenes. As both arrays have A005843 (even numbers) as their topmost row, this permutation fixes all of them.

Crossrefs

Inverse: A255554.
Similar or related permutations: A255407, A255408, A249817, A249818, A252460, A255551.

Programs

Formula

a(n) = A255551(A252460(n)).
Other identities:
a(2n) = 2n. [Fixes even numbers.]
For all n >= 1, a(A083141(n)) = A255550(n).
For all n >= 2, a(A000040(n)) = A000959(n).
For all n >= 2, a(A001248(n)) = A219178(n).

A260439 Column index to A255551: a(1) = 0; for n > 1: if n is Lucky number then a(n) = 1, otherwise for a(2k) = k, and for odd unlucky numbers, a(n) = 1 + the position at the stage where n is removed in the Lucky sieve.

Original entry on oeis.org

0, 1, 1, 2, 2, 3, 1, 4, 1, 5, 3, 6, 1, 7, 1, 8, 4, 9, 2, 10, 1, 11, 5, 12, 1, 13, 2, 14, 6, 15, 1, 16, 1, 17, 7, 18, 1, 19, 3, 20, 8, 21, 1, 22, 2, 23, 9, 24, 1, 25, 1, 26, 10, 27, 2, 28, 3, 29, 11, 30, 4, 31, 1, 32, 12, 33, 1, 34, 1, 35, 13, 36, 1, 37, 1, 38, 14, 39, 1, 40, 5, 41, 15, 42, 2, 43, 1, 44, 16, 45, 4, 46, 1, 47, 17, 48, 3, 49, 1, 50, 18, 51, 6, 52, 1
Offset: 1

Views

Author

Antti Karttunen, Jul 29 2015

Keywords

Comments

a(1) = 0, because 1 is outside of A255551 array proper.

Crossrefs

Cf. also A260438 (corresponding row index).
Cf. A078898, A246277, A260429, A260437, A260739 for column indices to other arrays similar to A255551.

Programs

  • Scheme
    (define (A260439 n) (cond ((= 1 n) 0) ((not (zero? (A145649 n))) 1) ((even? n) (/ n 2)) (else (let searchrow ((row 2)) (let searchcol ((col 1)) (cond ((>= (A255543bi row col) n) (if (= (A255543bi row col) n) (+ 1 col) (searchrow (+ 1 row)))) (else (searchcol (+ 1 col))))))))) ;; Code for A255543bi given in A255543.

Formula

Other identities. For all n >= 1:
a(2n) = n.
Also, for all n >= 2:
A255551(A260438(n), a(n)) = n.
a(A219178(n)) = 2.
Showing 1-10 of 16 results. Next