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.

This page as a plain text file.
%I A381217 #13 Feb 19 2025 11:21:03
%S A381217 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,
%T A381217 5,47,34,19,30,20,28,99,20,29,68,54,44,86,16,41,20,74,26,40,30,16,50,
%U A381217 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
%N A381217 a(n) is the least positive k such that the sum of the reverses of the first k primes is divisible by n.
%C A381217 a(n) is the least k such that A071602(k) is divisible by n.
%H A381217 Robert Israel, <a href="/A381217/b381217.txt">Table of n, a(n) for n = 1..10000</a>
%e A381217 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.
%p A381217 N:= 100: # for a(1) .. a(N)
%p A381217 rev:= proc(n) local L,i;
%p A381217   L:= convert(n,base,10);
%p A381217   add(L[-i]*10^(i-1),i=1..nops(L))
%p A381217 end proc:
%p A381217 V:= Vector(N):
%p A381217 Cands:= {$1..N}:
%p A381217 p:= 0: s:= 0:
%p A381217 for i from 1 while Cands <> {} do
%p A381217   p:= nextprime(p); s:= s + rev(p);
%p A381217 S:= select(t -> s mod t = 0, Cands);
%p A381217 if S <> {} then
%p A381217    V[convert(S,list)]:= i;
%p A381217    Cands:= Cands minus S
%p A381217 fi
%p A381217 od:
%p A381217 convert(V,list);
%t A381217 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 *)
%o A381217 (PARI) sumkrp(k) = my(v=primes(k)); sum(i=1, k, fromdigits(Vecrev(digits(v[i])))); \\ A071602
%o A381217 a(n) = my(k=1); while(sumkrp(k) % n, k++); k; \\ _Michel Marcus_, Feb 17 2025
%Y A381217 Cf. A071602.
%K A381217 nonn,base
%O A381217 1,3
%A A381217 _Robert Israel_, Feb 17 2025