login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A158457 a(1)=1, a(n+1) is the largest nonprime < sum of digits of n and a(n). 1

%I #9 May 28 2021 19:20:10

%S 1,1,1,1,4,8,12,9,16,15,6,6,8,10,4,9,15,12,10,10,1,1,4,8,12,9,16,15,

%T 15,16,9,12,6,10,6,12,10,10,10,12,6,10,6,12,10,9,18,18,20,14,9,14,10,

%U 8,16,16,16,18,21,16,12,9,16,15,15,16,18,21,16,21,9,16,15,15,16,18,21,16,21

%N a(1)=1, a(n+1) is the largest nonprime < sum of digits of n and a(n).

%H Harvey P. Dale, <a href="/A158457/b158457.txt">Table of n, a(n) for n = 1..1000</a>

%e 1, 1(<2=1+1), 1(<3=2+1), 1(<4=3+1), 4(<5=4+1), 8(<9=5+4), 12(<14=6+8), 9(<10=7+1+2), etc.

%p Contribution from _R. J. Mathar_, May 21 2010: (Start)

%p A007953 := proc(n) add(d,d=convert(n,base,10)) ; end proc:

%p A158457 := proc(n) if n = 1 then 1; else for a from A007953(n-1)+A007953(procname(n-1))-1 by -1 do if not isprime(a) then return a; end if; end do; end if; end proc:

%p seq(A158457(n),n=1..120) ; (End)

%t lnp[{n_,a_}]:=Module[{sd=Total[IntegerDigits[n+1]]+Total[ IntegerDigits[ a]]-1},While[PrimeQ[sd],sd--];{n+1,sd}]; NestList[lnp,{0,1},80][[All,2]] (* _Harvey P. Dale_, May 28 2021 *)

%Y Cf. A000027, A141468.

%K nonn,base,less

%O 1,5

%A _Juri-Stepan Gerasimov_, Mar 19 2009

%E Entries checked by _R. J. Mathar_, May 21 2010

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 29 13:55 EDT 2024. Contains 375517 sequences. (Running on oeis4.)