login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A171772 Number of steps needed to reach a prime when the map S(n)+M(n) is applied to n, or -1 if a prime is never reached. Here S(n) and M(N) mean the sum and the product of the digits of n in base 10. 2
1, 0, 0, 3, 0, 2, 0, 2, 2, 2, 0, 1, 0, 3, 1, 1, 0, 1, 0, 1, 1, 3, 0, 4, 1, 2, 1, 3, 0, 1, 0, 1, 2, 1, 1, 2, 0, 2, -1, 4, 0, 4, 0, 5, 1, 2, 0, 6, -1, 1, 1, 1, 0, 1, 2, 1, 1, 1, 0, 3, 0, 2, 2, 2, 1, 7, 0, 3, -1, 1, 0, 1, 0, -1, 1, 3, 3, 1, 0, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,4

COMMENTS

a(n)=0 if n is a prime.

LINKS

Robert Israel, Table of n, a(n) for n = 1..10000

EXAMPLE

a(4)=3 because 4->8->16->13 is prime.

a(39)=-1 because 39 -> 39 ->39 ... never reaches a prime.

a(49)=-1 because 49 -> 49 ->49 ... never reaches a prime.

a(69)=-1 because 69 -> 69 ->69 ... never reaches a prime.

a(74)=-1 because 74 -> 39 ->39 ... never reaches a prime.

a(28)=3 because 28 ->26 ->20 ->2.

MAPLE

f:= proc(n) local L;

  L:= convert(n, base, 10);

  convert(L, `+`)+convert(L, `*`);

end proc:

g:= proc(n) option remember; local v, w;

     if n::prime then return 0 fi;

     v:= f(n);

     if v = n then return -1 fi;

     w:= procname(v);

     if w = -1 then -1 else w+1 fi

end proc:

map(g, [$1..100]); # Robert Israel, Nov 03 2019

CROSSREFS

A variant of A074871.

Cf. A007954, A053837, A061762.

Sequence in context: A260737 A059339 A241181 * A092735 A035464 A194669

Adjacent sequences:  A171769 A171770 A171771 * A171773 A171774 A171775

KEYWORD

base,easy,sign

AUTHOR

R. J. Mathar, Oct 12 2010

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 11 14:30 EDT 2020. Contains 335626 sequences. (Running on oeis4.)