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.

A071602 Sum of the reverses of the first n primes.

Original entry on oeis.org

2, 5, 10, 17, 28, 59, 130, 221, 253, 345, 358, 431, 445, 479, 553, 588, 683, 699, 775, 792, 829, 926, 964, 1062, 1141, 1242, 1543, 2244, 3145, 3456, 4177, 4308, 5039, 5970, 6911, 7062, 7813, 8174, 8935, 9306, 10277, 10458, 10649, 11040, 11831
Offset: 1

Views

Author

Joseph L. Pe, Jun 02 2002

Keywords

Examples

			a(6) = reverse(2) + reverse(3) + reverse(5) + reverse(7) + reverse(11) + reverse(13) = 2 + 3 + 5 + 7 + 11 + 31 = 59.
		

Crossrefs

Partial sums of A004087.

Programs

  • Maple
    rev:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    ListTools:-PartialSums(map(rev, [seq(ithprime(i),i=1..200)])); # Robert Israel, Feb 17 2025
  • Mathematica
    f[n_] := Sum[ FromDigits[ Reverse[ IntegerDigits[Prime[i]]]], {i, 1, n}]; Table[ f[n], {n, 1, 50}]
    Accumulate[FromDigits[Reverse[IntegerDigits[ #]]] & /@ Prime[Range[ 50]]]  (* Harvey P. Dale, Jan 27 2011 *)
    Accumulate[IntegerReverse[Prime[Range[50]]]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Oct 10 2020 *)
  • PARI
    a(k) = my(v=primes(n)); sum(i=1, n, fromdigits(Vecrev(digits(v[i])))); \\ Michel Marcus, Feb 17 2025
  • Python
    from sympy import primerange
    from itertools import accumulate
    print(list(accumulate(int(str(p)[::-1]) for p in primerange(2, 198)))) # Michael S. Branicky, Jun 24 2022
    

Extensions

Edited by Robert G. Wilson v, Jun 07 2002