ARD1 - The Easiest Sequence Of the World!!

no tags 

 

I just found the easiest and funny sequence ever !
Your task is simple. Just write a program to find the Nth term of this sequence!!
The sequence is as follows::
3, 8, 12, 17, 22, 28, 35....

 

I just found the easiest and funny sequence ever !

Your task is simple. Just write a program to find the Nth term of this sequence!!

The sequence is as follows::

3, 8, 12, 17, 22, 28, 35....

 

 

Input

 

First line contains t = number of test cases

and then next t lines follow n. 

1<=n<=10^11

Note-- Value of n is modified to encourage better solutions!

Output

 

Just the output the nth term modulo 123456789

 

Example

Input:
3
1
2
3

Output:
3
8
12

hide comments
Zhiang: 2012-10-12 04:57:50

nice one..

Mostafa 36a2: 2012-10-12 04:57:50

so we are three boys here have the same Thinking_Way (is it an english word :) )
any way ... it's not the "Easiest in the word" ...:))

NeW AcP: 2012-10-12 04:57:50

where is the problem setter he needs to clarify our doubts.There can be many solutions kindly inc the terms in the seq. or remove this problem

Last edit: 2012-07-24 08:50:41
NeW AcP: 2012-10-12 04:57:50

yes,I totally agree with mostfa 3682 ,there can be more then 1 soution I am also getting the same answer as KEN but this does not lead to the answer given by RAJDEEP. atleast inc the sequence given as to avoid many type of solutions.
Problem setter should increase the sequence given in sample.

Last edit: 2012-07-23 11:44:14
Mostafa 36a2: 2012-10-12 04:57:50

don.t you think there is more than solution!!??
any thing except what you think will get wa!!

KEN: 2012-10-12 04:57:50

is my output correct???
15th term--100
16th term--113
17th term--118

Vaishali Behl: 2012-10-12 04:57:50

What is so funny about this sequence?

Himanshu Srivastava: 2012-10-12 04:57:50

finally...enjoyed solving :D

Aradhya: 2012-10-12 04:57:50

@still alive :: thanks :):)

Rajesh Kumar: 2012-10-12 04:57:50

sorry bro :) u cant tell the logic :)

RE: - Okay... :) BTW nice question :) :)

Last edit: 2012-06-29 11:22:18

Added by:Aradhya
Date:2012-06-28
Time limit:0.100s
Source limit:10000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:ASM32-GCC MAWK BC C-CLANG C NCSHARP CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG C99 COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY JULIA KTLN NIM NODEJS OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYPY3 PY_NBC R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET
Resource:Own Problem