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.

A241180 Start with n; add to it any of its digits; repeat; a(n) = minimal number of steps needed to reach a prime greater than n.

This page as a plain text file.
%I A241180 #21 Mar 18 2019 08:09:05
%S A241180 1,4,3,3,2,2,3,2,2,1,2,1,2,2,2,1,2,1,6,6,1,5,3,4,2,3,1,5,1,6,2,2,5,1,
%T A241180 2,4,4,1,3,4,3,4,1,3,2,3,2,2,1,5,2,2,2,1,4,1,4,3,3,3,1,3,3,3,1,2,1,2,
%U A241180 4,4,2,1,2,2,4,1,3,3,3,4,1,3,3,2,3,2,2
%N A241180 Start with n; add to it any of its digits; repeat; a(n) = minimal number of steps needed to reach a prime greater than n.
%C A241180 Is it a theorem that a(n) aways exists?
%C A241180 Yes: as long as nonzero digits are used, eventually you reach a number x starting with 10, large enough that there is a prime between x and 3*x/2.  All the numbers from x to 3*x/2 start with 1, so if you use the digit 1 you will eventually reach a prime. - _Robert Israel_, Mar 17 2019
%C A241180 A variant of this (A241181) sets a(n) = 0 if n is already a prime.
%D A241180 Eric Angelini, Posting to Sequence Fans Mailing List, Apr 20 2014
%H A241180 Hiroaki Yamanouchi, <a href="/A241180/b241180.txt">Table of n, a(n) for n = 1..100000</a>
%e A241180 Examples, in condensed notation:
%e A241180 1+1=2
%e A241180 2+2=4+4=8+8=16+1=17
%e A241180 3+3=6+6=12+1=13
%e A241180 4+4=8+8=16+1=17
%e A241180 5+5=10+1=11
%e A241180 6+6=12+1=13
%e A241180 7+7=14+4=18+1=19
%e A241180 8+8=16+1=17
%e A241180 9+9=18+1=19
%e A241180 10+1=11
%e A241180 11+1=12+1=13
%e A241180 12+1=13
%e A241180 13+3=16+1=17
%e A241180 14+4=18+1=19
%e A241180 15+1=16+1=17
%e A241180 16+1=17
%e A241180 17+1=18+1=19
%e A241180 18+1=19
%e A241180 19+9=28+8=36+3=39+9=48+8=56+5=61
%e A241180 20+2=22+2=24+2=26+6=32+2=34+3=37
%e A241180 ...
%p A241180 g:= proc(n,Nmax) option remember; local L,d,t;
%p A241180   if isprime(n) then return 0 fi;
%p A241180   if n > Nmax then return infinity fi;
%p A241180   L:= convert(convert(n,base,10),set) minus {0};
%p A241180   1 + min(seq(procname(n+d),d=L));
%p A241180 end proc:
%p A241180 f:= proc(n,Nmax) local L,d,t;
%p A241180   L:= convert(convert(n,base,10),set) minus {0};
%p A241180   1 + min(seq(g(n+d, Nmax),d=L))
%p A241180 end proc:
%p A241180 map(f, [$1..200], 1000); # _Robert Israel_, Mar 17 2019
%t A241180 A241180[n_] := Module[{c, nx},
%t A241180    c = 1; nx = n;
%t A241180    While[ !
%t A241180      AnyTrue[nx = Flatten[nx + IntegerDigits[nx]],
%t A241180       PrimeQ [#] && # > n &], c++];
%t A241180    Return[c]];
%t A241180 Table[A241180[i], {i, 100}] (* _Robert Price_, Mar 17 2019 *)
%Y A241180 Related sequences: A241173, A241174, A241175, A241176, A241177, A241178, A241179, A241180, A241181, A241182, A241183.
%K A241180 easy,nonn,base
%O A241180 1,2
%A A241180 _N. J. A. Sloane_, Apr 23 2014
%E A241180 a(23)-a(87) from _Hiroaki Yamanouchi_, Sep 05 2014