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.

A360790 Squared length of diagonal of right trapezoid with three consecutive prime length sides.

Original entry on oeis.org

8, 13, 41, 53, 137, 173, 305, 397, 533, 877, 977, 1373, 1697, 1885, 2245, 2813, 3517, 3737, 4493, 5077, 5345, 6277, 6953, 7937, 9413, 10217, 10613, 11465, 12077, 12785, 16165, 17165, 18869, 19325, 22237, 22837, 24665, 26605, 27925, 29933, 32141, 32765, 36497, 37253, 38953, 39745
Offset: 1

Views

Author

Aaron T Cowan, Feb 20 2023

Keywords

Comments

The value d is the square of the length of the diagonal of a trapezoid with a height and bases that are consecutive primes, respectively. The diagonal length is calculated using the Pythagorean theorem, but this distance is squared so that the value is an integer.

Examples

			        p(2)=3
        _ _ _ _
a(1):  |        \  d^2=2^2+(5-3)^2=8
p(1)=2 |_ _ _ _ _\
        p(3)=5
        p(3)=5
        _ _ _ _ _ _
a(2):  |           \    d^2=3^2 + (7-5)^2 = 9+4 = 13
p(2)=3 |            \
       |_ _ _ _ _ _ _\
        p(4)=7
a(3)= 5^2+(11-7)^2 = 25+16 = 41
a(7)= 17^2+(23-19)^2=305 = 5*61
		

Crossrefs

Programs

  • MATLAB
    %shorter 1 line version
    arrayfun(@(p) p^2+(nextprime(nextprime(p+1)+1)-nextprime(p+1))^2,[primes(10^6)])
    
  • Mathematica
    Map[(#[[1]]^2 + (#[[3]] - #[[2]])^2) &, Partition[Prime[Range[50]], 3, 1]] (* Amiram Eldar, Feb 24 2023 *)
  • PARI
    a(n) = prime(n)^2 + (prime(n+2)-prime(n+1))^2; \\ Michel Marcus, Feb 23 2023

Formula

a(n) = prime(n)^2 + (prime(n+2)-prime(n+1))^2.
a(n) = A001248(n) + A076821(n+1). - Michel Marcus, Feb 23 2023