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

A095759 Triangle T(row>=0, 0<= pos <=row) by rows: T(r,p) contains number of odd primes p in range [2^(r+1),2^(r+2)] for which A037888(p)=pos.

Original entry on oeis.org

1, 2, 0, 0, 2, 0, 2, 3, 0, 0, 0, 5, 2, 0, 0, 3, 4, 6, 0, 0, 0, 0, 15, 4, 4, 0, 0, 0, 3, 18, 15, 7, 0, 0, 0, 0, 0, 32, 20, 16, 7, 0, 0, 0, 0, 7, 33, 63, 24, 10, 0, 0, 0, 0, 0, 0, 63, 62, 88, 33, 9, 0, 0, 0, 0, 0, 12, 81, 135, 154, 56, 26, 0, 0, 0, 0, 0, 0, 0, 119, 150, 314, 197, 72, 20, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Antti Karttunen, Jun 12 2004

Keywords

Examples

			a(0) = T(0,0) = 1 as there is one prime 3 (11 in binary) in range ]2^1,2^2[ whose binary expansion is palindromic. a(1) = T(1,0) = 2 as there are two primes, 5 and 7 (101 and 111 in binary) in range ]2^2,2^3[ whose binary expansions are palindromic. a(2) = T(1,1) = 0, as there are no other primes in that range. a(3) = T(2,0) = 0, as there are no palindromic primes in range ]2^3,2^4[, but a(4) = T(2,1) = 2 as in the same range there are two primes 11 and 13 (1011 and 1101 in binary), whose binary expansion needs a flip of just one bit to become palindrome.
		

Crossrefs

Row sums: A036378. Bisection of the leftmost diagonal: A095741. Next diagonals: A095753, A095754, A095755, A095756. Central diagonal (column): A095760. The rightmost nonzero terms from each row: A095757 (i.e. central diagonal and next-to-central diagonal interleaved). The penultimate nonzero terms from each row: A095758. Cf. also A095749, A048700-A048704, A095742.

A048702 Binary palindromes of even length divided by 3.

Original entry on oeis.org

0, 1, 3, 5, 11, 15, 17, 21, 43, 51, 55, 63, 65, 73, 77, 85, 171, 187, 195, 211, 215, 231, 239, 255, 257, 273, 281, 297, 301, 317, 325, 341, 683, 715, 731, 763, 771, 803, 819, 851, 855, 887, 903, 935, 943, 975, 991
Offset: 0

Views

Author

Antti Karttunen, Mar 07 1999

Keywords

Comments

Let the length of A048701(n) in binary be 2k. Since it is a palindrome of even length, its digits come in pairs which are equal: one in the left half and the other in the right half. Thus, A048701(n) is a sum of numbers of the form d * 2^m * (2^(2k-2m-1) + 1). The number 2^(2k-2m-1) = 2 * 4^(k-m-1) is congruent to 2 (mod 3), so 2^(2k-2m-1) + 1 is divisible by 3. This means A048701(n) is divisible by 3, and therefore a(n) is an integer. - Michael B. Porter, Jun 18 2019

Crossrefs

Cf. A048701, A048704 (base 4 palindromes of even length divided by 5), A044051 (binary palindromes plus one divided by 2: (A006995(n)+1)/2), A000975.

Programs

  • Maple
    # Two unproved formulas which are not based upon first generating a palindrome and then dividing by 3, recursive and more direct:
    # Here d is 2^(the distance between the most and least significant 1-bit of n):
    bper3_rec := proc(n) option remember; local d; if(0 = n) then RETURN(0); fi; d := 2^([ log2(n) ]-A007814[ n ]);
    if(1 = d) then RETURN((2*bper3_rec(n-1))+d); else RETURN(bper3_rec(n-1)+d); fi; end;
    # or more directly (after K. Atanassov's formula for partial sums of A007814):
    bper3_direct := proc(n) local l,j; l := [ log2(n) ]; RETURN((2/3*((2^(2*l))-1))+1+ sum('(2^(l-j)*floor((n-(2^l)+2^j)/(2^(j+1))))','j'=0..l)); end;
    # Can anybody find an even simpler closed form? See A005187 for inspiration.
  • Mathematica
    Join[{0}, Reap[For[k = 1, k < 3000, k += 2, bb = IntegerDigits[k, 2]; If[bb == Reverse[bb], If[EvenQ[Length[bb]], Sow[k/3]]]]][[2, 1]]] (* Jean-François Alcover, Mar 04 2016 *)

Formula

a(n) = A048701(n)/3.
Conjecture: a(n) = 2^floor(log_2(n)) * Sum_{i=1..n} 1/(2^v_2(i)), for n >= 1, where v_2(i) = A007814(i) is the exponent of the highest power of 2 dividing i.
Conjecture: a(n) = n*2^floor(log_2(n)) - Sum_{i=1..floor(log_2(n))} 2^(floor(log_2(n)) - i)*floor(n/(2^i)).

A048703 Numbers which in base 4 are palindromes and have an even number of digits.

Original entry on oeis.org

0, 5, 10, 15, 65, 85, 105, 125, 130, 150, 170, 190, 195, 215, 235, 255, 1025, 1105, 1185, 1265, 1285, 1365, 1445, 1525, 1545, 1625, 1705, 1785, 1805, 1885, 1965, 2045, 2050, 2130, 2210, 2290, 2310, 2390
Offset: 0

Views

Author

Antti Karttunen, Mar 07 1999

Keywords

Comments

In quaternary base (base 4) the terms look like 0, 11, 22, 33, 1001, 1111, 1221, 1331, 2002, 2112, 2222, 2332, 3003, 3113, 3223, 3333, 100001, 101101, 102201, ..., which is a subsequence of A118595.
Zero is included as a(0) because we can consider it as having zero digits after leading zeros have been excluded.

Examples

			Each a(n) is obtained by concatenating the original base-4 expansion of n (which comes to the left hand, i.e., the most significant side) with its mirror-image (which comes to the right hand, i.e., the least significant side). For example, for a(4) we have 4 = '10' in base 4, which concatenated with its reversal '01' yields '1001', which when converted back to decimal yields 1*64 + 0*16 + 0*4 + 1*1 = 65, thus a(4)=65.
		

Crossrefs

Subsequence of A014192 (all numbers which are palindromes in base 4, including also those of odd number of digits).
Cf. also A048704 (this sequence divided by 5), A048701 (binary palindromes of even length), A055948, A110591, A118595, A030103, A007090, A000302.

Programs

  • Maple
    A048703(n) := (n) -> (2^(floor_log_2_coarse(n)+1))*n + sum('(bit_i(n, i+((-1)^i))*(2^(floor_log_2_coarse(n)-i)))', 'i'=0..floor_log_2_coarse(n));
    bit_i := (x,i) -> `mod`(floor(x/(2^i)),2);
    # Following is like floor_log_2 but even results are incremented by one:
    floor_log_2_coarse := proc(n) local nn,i: nn := n; for i from -1 to n do if(0 = nn) then RETURN(i+(1-(i mod 2))); fi: nn := floor(nn/2); od: end:
  • Mathematica
    q[n_] := EvenQ[IntegerLength[n, 4]] && PalindromeQ[IntegerDigits[n, 4]]; Select[Range[0, 2400, 5], q] (* Amiram Eldar, May 27 2024 *)
  • Python
    def A048703(n):
        s = bin(n-1)[2:]
        if len(s) % 2: s = '0'+s
        t = [s[i:i+2] for i in range(0,len(s),2)]
        return int(''.join(t+t[::-1]),2) # Chai Wah Wu, Feb 26 2021

Formula

a(0) = 0, and for n >= 1, a(n) = A030103(n) + (n * A000302(A110591(n))). - Antti Karttunen, Oct 30 2013
a(n) = 5*A048704(n). [This is just a consequence of the definition of A048704.] - Antti Karttunen, Jul 25 2013
Showing 1-3 of 3 results.