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-2 of 2 results.

A350987 Triangular numbers that are binary palindromes.

Original entry on oeis.org

0, 1, 3, 15, 21, 45, 153, 231, 325, 561, 903, 2145, 4095, 8385, 14535, 33153, 58311, 63903, 101475, 131841, 240471, 399171, 525825, 932295, 976503, 1044735, 1308153, 1395285, 1532125, 2100225, 3727815, 8394753, 14680071, 17913105, 33566721, 54054003, 59650503
Offset: 1

Views

Author

Amiram Eldar, Jan 28 2022

Keywords

Comments

This sequence is infinite since (2^k+1)*(2^k+2)/2 = A000217(A028401(k)) is a term for all k>1 (Trigg, 1974).

Examples

			3 is a term since 3 = A000217(2) = 2*(2+1)/2 is a triangular number, and 3 = 11_2 is also a binary palindromic number.
15 is a term since 15 = A000217(5) = 5*(5+1)/2 is a triangular number, and 15 = 1111_2 is also a binary palindromic number.
		

Crossrefs

Intersection of A000217 and A006995.
The binary version of A003098.
A028401 \ {6} is a subsequence.

Programs

  • Mathematica
    t[n_] := n*(n + 1)/2; Select[t /@ Range[0, 2*10^4], PalindromeQ[IntegerDigits[#, 2]] &]
  • Python
    from itertools import count, islice
    def agen():
        for i in count(0):
            t = i*(i+1)//2
            b = bin(t)[2:]
            if b == b[::-1]:
                yield t
    print(list(islice(agen(), 37))) # Michael S. Branicky, Jan 28 2022

Formula

a(n) = A000217(A350988(n)).

A350989 Numbers k such that both k and the k-th triangular number are binary palindromes.

Original entry on oeis.org

0, 1, 5, 9, 17, 21, 33, 65, 129, 257, 341, 513, 693, 1025, 1365, 1397, 2049, 4097, 8193, 16385, 21845, 32769, 43605, 65537, 87125, 87381, 131073, 262145, 524289, 1048577, 1398101, 2097153, 2796885, 4194305, 5592405, 5594453, 8388609, 16777217, 33554433, 67108865
Offset: 1

Views

Author

Amiram Eldar, Jan 28 2022

Keywords

Comments

This sequence is infinite since 2^k+1 is a term for all k>1.

Examples

			5 is a term since 5 = 101_2 is a binary palindromic number and A000217(5) = 5*(5+1)/2 = 15 = 1111_2 is a triangular number and also a binary palindromic number.
		

Crossrefs

The binary version of A008510.
Intersection of A006995 and A350988.
A000051 \ {3} is a subsequence.

Programs

  • Mathematica
    Select[Range[0, 10^6], And @@ PalindromeQ /@ IntegerDigits[{#, #*(# + 1)/2}, 2] &]
  • PARI
    isok(k) = my(bt=binary(k*(k+1)/2), bk=binary(k)); (bt == Vecrev(bt)) && (bk==Vecrev(bk)); \\ Michel Marcus, Jan 28 2022
    
  • Python
    from itertools import count, islice
    def ispal(s): return s == s[::-1]
    def ok(n): return ispal(bin(n)[2:]) and ispal(bin(n*(n+1)//2)[2:])
    print([k for k in range(10**6) if ok(k)]) # Michael S. Branicky, Jan 28 2022
Showing 1-2 of 2 results.