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.

A381217 a(n) is the least positive k such that the sum of the reverses of the first k primes is divisible by n.

Original entry on oeis.org

1, 1, 10, 5, 2, 16, 5, 20, 20, 3, 9, 16, 7, 5, 10, 30, 4, 20, 68, 44, 16, 20, 9, 20, 19, 7, 26, 5, 47, 34, 19, 30, 20, 28, 99, 20, 29, 68, 54, 44, 86, 16, 41, 20, 74, 26, 40, 30, 16, 50, 28, 82, 97, 26, 101, 51, 68, 47, 6, 44, 38, 53, 42, 30, 7, 20, 38, 28, 10, 99, 110, 20, 72, 121, 103, 137, 189
Offset: 1

Views

Author

Robert Israel, Feb 17 2025

Keywords

Comments

a(n) is the least k such that A071602(k) is divisible by n.

Examples

			a(3) = 10 because A071602(10) =  2 + 3 + 5 + 7 + 11 + 31 + 71 + 91 + 32 + 92 = 345 is divisible by 3, and no earlier term of A071602 is divisible by 3.
		

Crossrefs

Cf. A071602.

Programs

  • Maple
    N:= 100: # for a(1) .. a(N)
    rev:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    V:= Vector(N):
    Cands:= {$1..N}:
    p:= 0: s:= 0:
    for i from 1 while Cands <> {} do
      p:= nextprime(p); s:= s + rev(p);
    S:= select(t -> s mod t = 0, Cands);
    if S <> {} then
       V[convert(S,list)]:= i;
       Cands:= Cands minus S
    fi
    od:
    convert(V,list);
  • Mathematica
    s={};Do[ k=1;sm=0;Until[Divisible[sm,n],sm=sm+IntegerReverse[Prime[k]];k++];AppendTo[s,k-1],{n,77}];s (* James C. McMahon, Feb 19 2025 *)
  • PARI
    sumkrp(k) = my(v=primes(k)); sum(i=1, k, fromdigits(Vecrev(digits(v[i])))); \\ A071602
    a(n) = my(k=1); while(sumkrp(k) % n, k++); k; \\ Michel Marcus, Feb 17 2025