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

A087097 Lunar primes (formerly called dismal primes) (cf. A087062).

Original entry on oeis.org

19, 29, 39, 49, 59, 69, 79, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 109, 209, 219, 309, 319, 329, 409, 419, 429, 439, 509, 519, 529, 539, 549, 609, 619, 629, 639, 649, 659, 709, 719, 729, 739, 749, 759, 769, 809, 819, 829, 839, 849, 859, 869, 879, 901, 902, 903, 904, 905, 906, 907, 908, 909, 912, 913, 914, 915, 916, 917, 918, 919, 923, 924, 925, 926, 927, 928, 929, 934, 935, 936, 937, 938, 939, 945, 946, 947, 948, 949, 956, 957, 958, 959, 967, 968, 969, 978, 979, 989
Offset: 1

Views

Author

Marc LeBrun, Oct 20 2003

Keywords

Comments

9 is the multiplicative unit. A number is a lunar prime if it is not a lunar product (see A087062 for definition) r*s where neither r nor s is 9.
All lunar primes must contain a 9, so this is a subsequence of A011539.
Also, numbers k such that the lunar sum of the lunar prime divisors of k is k. - N. J. A. Sloane, Aug 23 2010
We have changed the name from "dismal arithmetic" to "lunar arithmetic" - the old name was too depressing. - N. J. A. Sloane, Aug 06 2014
(Lunar) composite numbers are not necessarily a product of primes. (For example 1 = 1*x for any x in {1, ..., 9} is not a prime but can't be written as the product of primes.) Therefore, to establish primality, it is not sufficient to consider only products of primes; one has to consider possible products of composite numbers as well. - M. F. Hasler, Nov 16 2018

Examples

			8 is not prime since 8 = 8*8. 9 is not prime since it is the multiplicative unit. 10 is not prime since 10 = 10*8. Thus 19 is the smallest prime.
		

Crossrefs

Programs

  • PARI
    A87097=select( is_A087097(n)={my(d); if( n<100, n>88||(n%10==9&&n>9), vecmax(d=digits(n))<9, 0, #d<5, vecmin(d)A087062(m,k)==n&&return))))}, [1..999]) \\ M. F. Hasler, Nov 16 2018

Formula

The set { m in A011539 | 9A054054(m) < min(A000030(m),A010879(m)) } (9ish numbers A011539 with 2 digits or such that the smallest digit is strictly smaller than the first and the last digit) is equal to this sequence up to a(1656) = 10099. The next larger 9ish number 10109 is also in that set but is the lunar square of 109, thus not in this sequence of primes. - M. F. Hasler, Nov 16 2018

A087019 Lunar squares: n*n where * is lunar multiplication (A087062).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 111, 112, 113, 114, 115, 116, 117, 118, 119, 200, 211, 222, 223, 224, 225, 226, 227, 228, 229, 300, 311, 322, 333, 334, 335, 336, 337, 338, 339, 400, 411, 422, 433, 444, 445, 446, 447, 448, 449, 500, 511, 522, 533, 544, 555, 556, 557, 558
Offset: 0

Views

Author

Marc LeBrun and N. J. A. Sloane, Oct 19 2003

Keywords

Comments

Sequence is not monotonic (1011*1011 = 1011111 > 1020*1020 = 1010200). In fact it even contains repetitions (11011*11011 = 11111*11111 = 111111111). See A172199. - N. J. A. Sloane, Dec 20 2010

Crossrefs

Cf. A087062 (lunar product), A087097 (lunar primes).

Programs

Formula

a(n)=A087062(n,n). - M. F. Hasler, Nov 15 2018

A342767 Array T(n, k), n, k > 0, read by antidiagonals; a variant of lunar multiplication (A087062) based on prime factorizations of numbers (see Comments section for precise definition).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 4, 3, 4, 1, 1, 2, 4, 4, 2, 1, 1, 4, 3, 8, 3, 4, 1, 1, 2, 6, 4, 4, 6, 2, 1, 1, 8, 3, 8, 5, 8, 3, 8, 1, 1, 4, 8, 4, 6, 6, 4, 8, 4, 1, 1, 4, 9, 16, 5, 12, 5, 16, 9, 4, 1, 1, 2, 6, 8, 8, 6, 6, 8, 8, 6, 2, 1, 1, 8, 3, 8, 9, 16, 7, 16, 9, 8, 3, 8, 1
Offset: 1

Views

Author

Rémy Sigrist, Apr 02 2021

Keywords

Comments

To compute T(n, k):
- write the prime factors of n and of k in ascending order with multiplicities on two lines, right aligned,
- to "multiply" two prime numbers: take the smallest,
- to "add" two prime numbers: take the largest,
- for example, for T(12, 14):
12 -> 2 2 3
14 -> x 2 7
-------
2 2 3
+ 2 2 2
---------
2 2 2 3 -> 24 = T(12, 14)
This sequence is closely related to lunar multiplication (A087062):
- let n and k be two p-smooth numbers,
- let f be the function that associates to a p-smooth number, say m, the unique number whose (p+1)-base digits are prime, nondecreasing and whose product is m,
- let g be the inverse of f,
- then for any p-smooth numbers n and k, T(n, k) = g(f(n) "*" f(k)) where "*" denotes lunar product in base p+1,
- as T(n, p) = n for any prime number >= A006530(n), we don't have prime numbers here,
- however, if we consider only p-smooth numbers (for some prime number p), then p is the "unit" and the semiprimes p*q (with q <= p) are "prime".

Examples

			Array T(n, k) begins:
  n\k|  1  2   3   4   5   6   7   8   9  10  11  12  13  14
  ---+------------------------------------------------------
    1|  1  1   1   1   1   1   1   1   1   1   1   1   1   1
    2|  1  2   2   4   2   4   2   8   4   4   2   8   2   4  ->  A061142
    3|  1  2   3   4   3   6   3   8   9   6   3  12   3   6  ->  A079065
    4|  1  4   4   8   4   8   4  16   8   8   4  16   4   8
    5|  1  2   3   4   5   6   5   8   9  10   5  12   5  10
    6|  1  4   6   8   6  12   6  16  18  12   6  24   6  12
    7|  1  2   3   4   5   6   7   8   9  10   7  12   7  14
    8|  1  8   8  16   8  16   8  32  16  16   8  32   8  16
    9|  1  4   9   8   9  18   9  16  27  18   9  36   9  18
   10|  1  4   6   8  10  12  10  16  18  20  10  24  10  20
   11|  1  2   3   4   5   6   7   8   9  10  11  12  11  14
   12|  1  8  12  16  12  24  12  32  36  24  12  48  12  24
   13|  1  2   3   4   5   6   7   8   9  10  11  12  13  14
   14|  1  4   6   8  10  12  14  16  18  20  14  24  14  28
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

T(n, k) = T(k, n).
T(n, n) = A342768(n).
T(n, 1) = 1.
T(n, 2) = A061142(n).
T(n, 3) = A079065(n).
T(n, p) = n for any prime number p >= A006530(n).

A202672 Array: row n shows the coefficients of the characteristic polynomial of the n-th principal submatrix of the symmetric matrix A087062 based on (1,1,1,1,...); by antidiagonals.

Original entry on oeis.org

1, -1, 1, -3, 1, 1, -5, 6, -1, 1, -7, 15, -10, 1, 1, -9, 28, -35, 15, -1, 1, -11, 45, -84, 70, -21, 1, 1, -13, 66, -165, 210, -126, 28, -1, 1, -15, 91, -286, 495, -462, 210, -36, 1, 1, -17, 120, -455, 1001, -1287, 924, -330, 45, -1, 1, -19, 153
Offset: 1

Views

Author

Clark Kimberling, Dec 22 2011

Keywords

Comments

Let p(n)=p(n,x) be the characteristic polynomial of the n-th principal submatrix of A087062. The zeros of p(n) are positive, and they interlace the zeros of p(n+1).
Closely related to A076756; however, for example, successive rows of A076756 are (1,-3,1), (-1,5,-6,1), compared to rows (1,-3,1), (1,-5,6,-1) of A202672.

Examples

			The 1st principal submatrix (ps) of A087062 is {{1}} (using Mathematica matrix notation), with p(1)=1-x and zero-set {1}.
...
The 2nd ps is {{1,1},{1,2}}, with p(2)=1-3x+x^2 and zero-set {0.381..., 2.618...}.
...
The 3rd ps is {{1,1,1},{1,2,2},{1,2,3}}, with p(3)=1-5x+6x^2-x^3 and zero-set {0.283..., 0.426..., 8.290...}.
...
Top of the array:
1...-1
1...-3....1
1...-5....6....-1
1...-7...15...-10....1
1...-9...28...-35...15...-1
		

Crossrefs

Cf. A087062, A202673 (based on n), A202671 (based on n^2), A202605 (based on Fibonacci numbers), A076756.

Programs

  • Mathematica
    U[n_] := NestList[Most[Prepend[#, 0]] &, #, Length[#] - 1] &[Table[1, {k, 1, n}]];
    L[n_] := Transpose[U[n]];
    F[n_] := CharacteristicPolynomial[L[n].U[n], x];
    c[n_] := CoefficientList[F[n], x]
    TableForm[Flatten[Table[F[n], {n, 1, 10}]]]
    Table[c[n], {n, 1, 12}]
    Flatten[%]
    TableForm[Table[c[n], {n, 1, 10}]]
    Table[(F[k] /. x -> -2), {k, 1, 30}] (* A007583 *)
    Table[(F[k] /. x -> 2), {k, 1, 30}]  (* A087168 *)

A343033 Array T(n, k), n, k > 0, read by antidiagonals; a variant of lunar multiplication (A087062) based on prime exponents of numbers (see Comments section for precise definition).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 2, 5, 2, 1, 1, 5, 3, 3, 5, 1, 1, 6, 7, 4, 7, 6, 1, 1, 7, 15, 5, 5, 15, 7, 1, 1, 2, 11, 6, 11, 6, 11, 2, 1, 1, 3, 3, 7, 35, 35, 7, 3, 3, 1, 1, 10, 5, 4, 13, 30, 13, 4, 5, 10, 1, 1, 11, 21, 9, 5, 77, 77, 5, 9, 21, 11, 1
Offset: 1

Views

Author

Rémy Sigrist and N. J. A. Sloane, Apr 03 2021

Keywords

Comments

To compute T(n, k):
- write the prime exponents of n and of k on two lines, right aligned (these lines correspond to rows of A067255 in reversed order),
- to "multiply" two prime numbers: take the smallest,
- to "add" two prime numbers: take the largest,
- for example, for T(12, 14):
(11 7 5 3 2)
12 --> 1 2
14 --> x 1 0 0 1
---------
1 1
0 0
0 0
+ 1 1
-----------
1 1 0 1 1 --> 462 = T(12, 14)
This sequence is closely related to lunar multiplication (A087062):
- for any b > 1, let S_b be the set of nonnegative integers m such that A051903(m)< b,
- there is a natural bijection f from S_b to the set of nonnegative integers:
f(Product_{k >= 0} prime(k)^d(k)) = Sum_{k >= 0} d(k) * b^k,
- let g be the inverse of f,
- then for any numbers n and k in S_b, we have:
T(n, k) = g(f(n) "*" f(k)) where "*" denotes lunar product in base b,
- the corresponding addition table is A003990.

Examples

			Array T(n, k) begins:
  n\k|  1   2   3   4   5    6    7   8   9   10   11   12   13   14
  ----  -  --  --  --  --  ---  ---  --  --  ---  ---  ---  ---  ---
    1|  1   1   1   1   1    1    1   1   1    1    1    1    1    1
    2|  1   2   3   2   5    6    7   2   3   10   11    6   13   14  --> A007947
    3|  1   3   5   3   7   15   11   3   5   21   13   15   17   33  --> A328915
    4|  1   2   3   4   5    6    7   4   9   10   11   12   13   14  --> A007948
    5|  1   5   7   5  11   35   13   5   7   55   17   35   19   65
    6|  1   6  15   6  35   30   77   6  15  210  143   30  221  462
    7|  1   7  11   7  13   77   17   7  11   91   19   77   23  119
    8|  1   2   3   4   5    6    7   8   9   10   11   12   13   14
    9|  1   3   5   9   7   15   11   9  25   21   13   45   17   33
   10|  1  10  21  10  55  210   91  10  21  110  187  210  247  910
   11|  1  11  13  11  17  143   19  11  13  187   23  143   29  209
   12|  1   6  15  12  35   30   77  12  45  210  143   60  221  462
   13|  1  13  17  13  19  221   23  13  17  247   29  221   31  299
   14|  1  14  33  14  65  462  119  14  33  910  209  462  299  238
		

Crossrefs

Programs

  • PARI
    T(n,k) = { my (r=1, pp=factor(n)[,1]~, qq=factor(k)[,1]~); for (i=1, #pp, for (j=1, #qq, my (p=prime(primepi(pp[i])+primepi(qq[j])-1), v=valuation(r, p), w=min(valuation(n, pp[i]), valuation(k, qq[j]))); if (w>v, r*=p^(w-v)))); r }

Formula

T(n, k) = T(k, n).
T(n, 1) = 1.
T(n, 2) = A007947(n).
T(n, 3) = A328915(n).
T(n, 4) = A007948(n).
T(n, n) = A343035(n).
A051903(T(n, k)) = min(A051903(n), A051903(k)).

A109752 Using the lunar product (see A087062 for definition), numbers n such that if n divides a*b, then n must divide either a or b. The multiplicative identity, 9, is excluded by convention.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 90
Offset: 1

Views

Author

David Wasserman, Aug 11 2005

Keywords

Comments

This condition is one of the definitions of a prime, so these numbers could be called lunar primes (cf. A087097).

Examples

			90 is a member because the lunar multiples of 90 are the same as the numbers ending with a 0 and if neither a nor b ends in 0, then neither does a*b.
		

Crossrefs

A202605 Array: row n shows the coefficients of the characteristic polynomial of the n-th principal submatrix of the Fibonacci self-fusion matrix (A202453).

Original entry on oeis.org

1, -1, 1, -3, 1, 1, -6, 9, -1, 1, -9, 26, -24, 1, 1, -12, 52, -96, 64, -1, 1, -15, 87, -243, 326, -168, 1, 1, -18, 131, -492, 1003, -1050, 441, -1, 1, -21, 184, -870, 2392, -3816, 3265, -1155, 1, 1, -24, 246, -1404, 4871, -10500, 13710
Offset: 1

Views

Author

Clark Kimberling, Dec 21 2011

Keywords

Comments

Let p(n)=p(n,x) be the characteristic polynomial of the n-th principal submatrix. The zeros of p(n) are positive and interlace the zeros of p(n+1). (See the references and examples.)
Following is a guide to sequences (f(n)) for symmetric matrices (self-fusion matrices) and characteristic polynomials. Notation: F(k)=A000045(k) (Fibonacci numbers); floor(n*tau)=A000201(n) (lower Wythoff sequence); "periodic x,y" represents the sequence (x,y,x,y,x,y,...).
f(n)........ symmetric matrix.. char. polynomial
1............... A087062....... A202672
n............... A115262....... A202673
n^2............. A202670....... A202671
2n-1............ A202674....... A202675
3n-2............ A202676....... A202677
n(n+1)/2........ A185957....... A202678
2^n-1........... A202873....... A202767
2^(n-1)......... A115216....... A202868
floor(n*tau).... A202869....... A202870
F(n)............ A202453....... A202605
F(n+1).......... A202874....... A202875
Lucas(n)........ A202871....... A202872
F(n+2)-1........ A202876....... A202877
F(n+3)-2........ A202970....... A202971
(F(n))^2........ A203001....... A203002
(F(n+1))^2...... A203003....... A203004
C(2n,n)......... A115255....... A203005
(-1)^(n+1)...... A003983....... A076757
periodic 1,0.... A203905....... A203906
periodic 1,0,0.. A203945....... A203946
periodic 1,0,1.. A203947....... A203948
periodic 1,1,0.. A203949....... A203950
periodic 1,0,0,0 A203951....... A203952
periodic 1,2.... A203953....... A203954
periodic 1,2,3.. A203955....... A203956
...
In the cases listed above, the zeros of the characteristic polynomials are positive. If more general symmetric matrices are used, the zeros are all real but not necessarily positive - but they do have the interlace property. For a guide to such matrices and polynomials, see A202605.

Examples

			The 1st principal submatrix (ps) of A202453 is {{1}} (using Mathematica matrix notation), with p(1) = 1-x and zero-set {1}.
...
The 2nd ps is {{1,1},{1,2}}, with p(2) = 1-3x+x^2 and zero-set {0.382..., 2.618...}.
...
The 3rd ps is {{1,1,2},{1,2,3},{2,3,6}}, with p(3) = 1-6x+9x^2-x^3 and zero-set {0.283..., 0.426..., 8.290...}.
  ...
Top of the array A202605:
  1,   -1;
  1,   -3,    1;
  1,   -6,    9,   -1;
  1,   -9,   26,  -24,    1;
  1,  -12,   52,  -96,   64,   -1;
  1,  -15,   87, -243,  326, -168,    1;
		

Crossrefs

Programs

  • Mathematica
    f[k_] := Fibonacci[k];
    U[n_] := NestList[Most[Prepend[#, 0]] &, #, Length[#] - 1] &[Table[f[k], {k, 1, n}]];
    L[n_] := Transpose[U[n]];
    F[n_] := CharacteristicPolynomial[L[n].U[n], x];
    c[n_] := CoefficientList[F[n], x]
    TableForm[Flatten[Table[F[n], {n, 1, 10}]]]
    Table[c[n], {n, 1, 12}]
    Flatten[%]
    TableForm[Table[c[n], {n, 1, 10}]]

A011539 "9ish numbers": decimal representation contains at least one nine.

Original entry on oeis.org

9, 19, 29, 39, 49, 59, 69, 79, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 109, 119, 129, 139, 149, 159, 169, 179, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 209, 219, 229, 239, 249, 259, 269, 279, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298
Offset: 1

Views

Author

Keywords

Comments

The 9ish numbers are closed under lunar multiplication. The lunar primes (A087097) are a subset.
Almost all numbers are 9ish, in the sense that the asymptotic density of this set is 1: Among the 9*10^(n-1) n-digit numbers, only a fraction of 0.8*0.9^(n-1) doesn't have a digit 9, and this fraction tends to zero (< 1/10^k for n > 22k-3). This explains the formula a(n) ~ n. - M. F. Hasler, Nov 19 2018
A 9ish number is a number whose largest decimal digit is 9. - Stefano Spezia, Nov 16 2023

Examples

			E.g. 9, 19, 69, 90, 96, 99 and 1234567890 are all 9ish.
		

Crossrefs

Cf. A088924 (number of n-digit terms).
Cf. A087062 (lunar product), A087097 (lunar primes).
A102683 (number of digits 9 in n); fixed points > 8 of A068505.
Cf. Numbers with at least one digit b-1 in base b : A074940 (b=3), A337250 (b=4), A337572 (b=5), A333656 (b=6), A337141 (b=7), A337239 (b=8), A338090 (b=9), this sequence (b=10), A095778 (b=11).
Cf. Numbers with no digit b-1 in base b: A005836 (b=3), A023717 (b=4), A020654 (b=5), A037465 (b=6), A020657 (b=7), A037474 (b=8), A037477 (b=9), A007095 (b=10), A171397 (b=11).
Supersequence of A043525.

Programs

  • GAP
    Filtered([1..300],n->9 in ListOfDigits(n)); # Muniru A Asiru, Feb 25 2019
    
  • Haskell
    a011539 n = a011539_list !! (n-1)
    a011539_list = filter ((> 0) . a102683) [1..]  -- Reinhard Zumkeller, Dec 29 2011
    
  • Maple
    seq(`if`(numboccur(9, convert(n, base, 10))>0, n, NULL), n=0..100); # François Marques, Oct 12 2020
  • Mathematica
    Select[ Range[ 0, 100 ], (Count[ IntegerDigits[ #, 10 ], 9 ]>0)& ] (* François Marques, Oct 12 2020 *)
    Select[Range[300],DigitCount[#,10,9]>0&] (* Harvey P. Dale, Mar 04 2023 *)
  • PARI
    is(n)=n=vecsort(digits(n));n[#n]==9 \\ Charles R Greathouse IV, May 15 2013
    
  • PARI
    select( is_A011539(n)=vecmax(digits(n))==9, [1..300]) \\ M. F. Hasler, Nov 16 2018
    
  • Python
    def ok(n): return '9' in str(n)
    print(list(filter(ok, range(299)))) # Michael S. Branicky, Sep 19 2021
    
  • Python
    def A011539(n):
        def f(x):
            l = (s:=str(x)).find('9')
            if l >= 0: s = s[:l]+'8'*(len(s)-l)
            return n+int(s,9)
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        return m # Chai Wah Wu, Dec 04 2024

Formula

Complement of A007095. A102683(a(n)) > 0 (defines this sequence). A068505(a(n)) = a(n): fixed points of A068505 are the terms of this sequence and the numbers < 9. - Reinhard Zumkeller, Dec 29 2011, edited by M. F. Hasler, Nov 16 2018
a(n) ~ n. - Charles R Greathouse IV, May 15 2013

A003983 Array read by antidiagonals with T(n,k) = min(n,k).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 3, 2, 1, 1, 2, 3, 3, 2, 1, 1, 2, 3, 4, 3, 2, 1, 1, 2, 3, 4, 4, 3, 2, 1, 1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1
Offset: 1

Views

Author

Keywords

Comments

Also, "correlation triangle" for the constant sequence 1. - Paul Barry, Jan 16 2006
Antidiagonal sums are in A002620.
As a triangle, row sums are A002620. T(2n,n)=n+1. Diagonal sums are A001399. Construction: Take antidiagonal triangle of MM^T where M is the sequence array for the constant sequence 1 (lower triangular matrix with all 1's). - Paul Barry, Jan 16 2006
From Franklin T. Adams-Watters, Sep 25 2011: (Start)
As a triangle, count up to ceiling(n/2) and back down again (repeating the central term when n is even).
When the first two instances of each number are removed from the sequence, the original sequence is recovered.
(End)

Examples

			Triangle version begins
  1;
  1, 1;
  1, 2, 1;
  1, 2, 2, 1;
  1, 2, 3, 2, 1;
  1, 2, 3, 3, 2, 1;
  1, 2, 3, 4, 3, 2, 1;
  1, 2, 3, 4, 4, 3, 2, 1;
  1, 2, 3, 4, 5, 4, 3, 2, 1;
  ...
		

Crossrefs

Programs

  • Haskell
    a003983 n k = a003983_tabl !! (n-1) !! (k-1)
    a003983_tabl = map a003983_row [1..]
    a003983_row n = hs ++ drop m (reverse hs)
       where hs = [1..n' + m]
             (n',m) = divMod n 2
    -- Reinhard Zumkeller, Aug 14 2011
    
  • Maple
    a(n) = min(floor(1/2 + sqrt(2*n)) - (2*n + round(sqrt(2*n)) - round(sqrt(2*n))^2)/2+1, (2*n + round(sqrt(2*n)) - round(sqrt(2*n))^2)/2) # Leonid Bedratyuk, Dec 13 2009
  • Mathematica
    Flatten[Table[Min[n-k+1, k], {n, 1, 14}, {k, 1, n}]] (* Jean-François Alcover, Feb 23 2012 *)
  • PARI
    T(n,k) = min(n,k) \\ Charles R Greathouse IV, Feb 06 2017
    
  • Python
    from math import isqrt
    def A003983(n):
        a = (m:=isqrt(k:=n<<1))+(k>m*(m+1))
        x = n-(a*(a-1)>>1)
        return min(x,a-x+1) # Chai Wah Wu, Jun 14 2025

Formula

Number triangle T(n, k) = Sum_{j=0..n} [j<=k][j<=n-k]. - Paul Barry, Jan 16 2006
G.f.: 1/((1-x)*(1-x*y)*(1-x^2*y)). - Christian G. Bower, Jan 17 2006
a(n) = min(floor( 1/2 + sqrt(2*n)) - (2*n + round(sqrt(2*n)) - round(sqrt(2*n))^2)/2+1, (2*n + round(sqrt(2*n)) - round(sqrt(2*n))^2)/2). - Leonid Bedratyuk, Dec 13 2009

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Nov 08 2000
Entry revised by N. J. A. Sloane, Dec 05 2006

A087061 Array A(n, k) = lunar sum n + k (n >= 0, k >= 0) read by antidiagonals.

Original entry on oeis.org

0, 1, 1, 2, 1, 2, 3, 2, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 3, 4, 5, 6, 5, 4, 3, 4, 5, 6, 7, 6, 5, 4, 4, 5, 6, 7, 8, 7, 6, 5, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 6, 7, 8, 9, 10, 11, 11, 9, 8, 7, 6, 6, 7, 8, 9, 11, 11, 12, 11, 12, 9, 8, 7, 6, 7, 8, 9, 12, 11, 12, 13, 12, 12, 13, 9, 8
Offset: 0

Views

Author

Marc LeBrun, Oct 09 2003

Keywords

Comments

There are no carries in lunar arithmetic. For each pair of lunar digits, to Add, take the lArger, but to Multiply, take the sMaller. For example:
169
+ 248
------
269
and
169
x 248
------
168
144
+ 122
--------
12468
Addition and multiplication are associative and commutative and multiplication distributes over addition. E.g., 357 * (169 + 248) = 357 * 269 = 23567 = 13567 + 23457 = (357 * 169) + (357 * 248). Note that 0 + x = x and 9*x = x for all x.
We have changed the name from "dismal arithmetic" to "lunar arithmetic" - the old name was too depressing. - N. J. A. Sloane, Aug 06 2014

Examples

			Lunar addition table A(n, k) begins:
   [0] 0  1  2  3  4  5  6  7  8  9 10 11 12 13 ...
   [1] 1  1  2  3  4  5  6  7  8  9 11 11 12 13 ...
   [2] 2  2  2  3  4  5  6  7  8  9 12 12 12 13 ...
   [3] 3  3  3  3  4  5  6  7  8  9 13 13 13 13 ...
   [4] 4  4  4  4  4  5  6  7  8  9 14 14 14 14 ...
   [5] 5  5  5  5  5  5  6  7  8  9 15 15 15 15 ...
   [6] 6  6  6  6  6  6  6  7  8  9 16 16 16 16 ...
   [7] 7  7  7  7  7  7  7  7  8  9 17 17 17 17 ...
   [8] 8  8  8  8  8  8  8  8  8  9 18 18 18 18 ...
   [9] 9  9  9  9  9  9  9  9  9  9 19 19 19 19 ...
    ...
Seen as a triangle T(n, k):
   [0] 0;
   [1] 1, 1;
   [2] 2, 1, 2;
   [3] 3, 2, 2, 3;
   [4] 4, 3, 2, 3, 4;
   [5] 5, 4, 3, 3, 4, 5;
   [6] 6, 5, 4, 3, 4, 5, 6;
   [7] 7, 6, 5, 4, 4, 5, 6, 7;
   [8] 8, 7, 6, 5, 4, 5, 6, 7, 8;
   [9] 9, 8, 7, 6, 5, 5, 6, 7, 8, 9;
		

Crossrefs

Cf. A087062 (multiplication), A087097 (primes), A004197, A003056.

Programs

  • Maple
    # Maple programs for lunar arithmetic are in A087062.
    # Seen as a triangle:
    T := (n, k) -> if n - k > k then n - k else k fi:
    for n from 0 to 9 do seq(T(n, k), k = 0..n) od; # Peter Luschny, May 07 2023
  • Mathematica
    ladd[x_, y_] := FromDigits[MapThread[Max, IntegerDigits[#, 10, Max @@ IntegerLength /@ {x, y}] & /@ {x, y}]]; Flatten[Table[ladd[k, n - k], {n, 0, 13}, {k, 0, n}]] (* Davin Park, Sep 29 2016 *)
  • PARI
    ladd=A087061(m,n)=fromdigits(vector(if(#(m=digits(m))>#n=digits(n),#n=Vec(n,-#m),#m<#n,#m=Vec(m,-#n),#n),k,max(m[k],n[k]))) \\  M. F. Hasler, Nov 12 2017, updated Nov 15 2018

Formula

T(n, k) = n - k if n - k > k, otherwise k, if seen as a triangle. See A004197, which is a kind of dual. In fact T(n, k) + A004197(n, k) = A003056(n, k). - Peter Luschny, May 07 2023

Extensions

Edited by M. F. Hasler, Nov 12 2017
Showing 1-10 of 29 results. Next